[GH-ISSUE #2614] AutoModelForCausalLM and .ollama/models #1541

Closed
opened 2026-04-12 11:27:04 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @Demirrr on GitHub (Feb 20, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2614

Can we create an instance of AutoModelForCausalLM from downloaded language models ~/.ollama/models?

By this, the finetunning and using finetuned model via ollama would be easier.

from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "mistralai/Mixtral-8x7B-v0.1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
Originally created by @Demirrr on GitHub (Feb 20, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2614 Can we create an instance of `AutoModelForCausalLM` from downloaded language models `~/.ollama/models`? By this, the finetunning and using finetuned model via ollama would be easier. ```python from transformers import AutoModelForCausalLM, AutoTokenizer model_id = "mistralai/Mixtral-8x7B-v0.1" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained(model_id) ```
Author
Owner

@jmorganca commented on GitHub (Feb 20, 2024):

Hi @Demirrr, thanks so much for creating an issue. Check out this doc for instructions on importing PyTorch or Safetensors models (and there's a maintainer that's working on making this much easier).

In the meantime, I know there's quite a few steps, and so let me know if I can help you convert the model at all – my email is in my github profile :)

<!-- gh-comment-id:1954863138 --> @jmorganca commented on GitHub (Feb 20, 2024): Hi @Demirrr, thanks so much for creating an issue. Check out [this doc](https://github.com/jmorganca/ollama/blob/main/docs/import.md) for instructions on importing PyTorch or Safetensors models (and there's a maintainer that's working on making this much easier). In the meantime, I know there's quite a few steps, and so let me know if I can help you convert the model at all – my email is in my github profile :)
Author
Owner

@categoric-dev commented on GitHub (Jan 6, 2025):

@jmorganca Could we potentially transfer or convert the ollama blob into a model.safetensors format, enabling its utilization alongside AutoModelForCausalLM and AutoTokenizer?

<!-- gh-comment-id:2573785277 --> @categoric-dev commented on GitHub (Jan 6, 2025): @jmorganca Could we potentially transfer or convert the ollama blob into a model.safetensors format, enabling its utilization alongside AutoModelForCausalLM and AutoTokenizer?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1541