cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Community Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Download Dolly model on local machine

FutureLegend
New Contributor III

Hi~ I am new to LLM engineering, and am trying to download the Dolly-v2-7b model on local machine, so I don't need to connect to internet each time I am going to run the Dolly-v2-7b. Is it possible to do that? Thanks a lot!

1 ACCEPTED SOLUTION

Accepted Solutions

FutureLegend
New Contributor III

Hi Kaniz and Sean, thanks for your responses and time.
I was trying Kaniz's method, but got a reply from Sean, so I tried that too. I downloaded the file from the link Sean provided and saved it on my local machine, then used the code for Dollyv2 (https://huggingface.co/databricks/dolly-v2-3b) and ran it successfully without connecting to Huggingface/ Databricks. Haven't tried without internet, but I think it will work too. Thanks again Kaniz and Sean for your replies!

code I used:

pip install "accelerate>=0.16.0,<1" "transformers[torch]>=4.28.1,<5" "torch>=1.13.1,<2"

import torch
from transformers import pipeline
 
generate_text = pipeline(model="local_machine/path/to/downloaded_Dolly_folder", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
 
res = generate_text("Explain to me the difference between nuclear fission and fusion.")
print(res[0]["generated_text"])

View solution in original post

3 REPLIES 3

Kaniz
Community Manager
Community Manager

Hi @FutureLegendTo download the Dolly-v2-7b model on your local machine, you can use MLflow Export-Import to migrate MLflow models from one workspace to another. You can copy the model from one workspace to another, from a development to a production workspace.

However, it would be best if you had MLflow 2.3 installed, and any cluster with the Hugging Face transformers library installed can be used for batch inference. The transformers library comes preinstalled on 10.4 LTS ML and above.

Here are the steps you can follow:

1. Export the Dolly-v2-7b model from your Databricks workspace using MLflow Export-Import.
2. Download the exported model to your local machine.
3. Install the Hugging Face transformers library on your local machine.
4. Load the exported model to your local machine using the transformers library.

Sources:
https://docs.databricks.com/machine-learning/manage-model-lifecycle/workspace-model-registry.html
https://docs.databricks.com/machine-learning/train-model/huggingface/model-inference-nlp.html

sean_owen
Honored Contributor II
Honored Contributor II

@Kaniz this is not necessary for downloading a model; it actually has nothing to do with Databricks.

Dolly is hosted on Hugging Face. If you download it via transformers, it will actually cache it and not download again, already. But you can always just download the files of any model to a local dir: https://huggingface.co/databricks/dolly-v2-12b/tree/main You then load that local dir as a model.

FutureLegend
New Contributor III

Hi Kaniz and Sean, thanks for your responses and time.
I was trying Kaniz's method, but got a reply from Sean, so I tried that too. I downloaded the file from the link Sean provided and saved it on my local machine, then used the code for Dollyv2 (https://huggingface.co/databricks/dolly-v2-3b) and ran it successfully without connecting to Huggingface/ Databricks. Haven't tried without internet, but I think it will work too. Thanks again Kaniz and Sean for your replies!

code I used:

pip install "accelerate>=0.16.0,<1" "transformers[torch]>=4.28.1,<5" "torch>=1.13.1,<2"

import torch
from transformers import pipeline
 
generate_text = pipeline(model="local_machine/path/to/downloaded_Dolly_folder", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
 
res = generate_text("Explain to me the difference between nuclear fission and fusion.")
print(res[0]["generated_text"])
Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!