Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,12 @@
|
|
1 |
-
import
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
|
4 |
+
# Define the local directory where the model will be saved
|
5 |
+
local_model_dir = "./llama-2-7b-hf"
|
6 |
+
|
7 |
+
# Create the directory if it doesn't exist
|
8 |
+
os.makedirs(local_model_dir, exist_ok=True)
|
9 |
+
|
10 |
+
# Download the model and tokenizer
|
11 |
+
model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-hf", cache_dir=local_model_dir)
|
12 |
+
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-hf", cache_dir=local_model_dir)
|