raygiles3 commited on
Commit
6c95140
·
verified ·
1 Parent(s): 815019a

Create copyLLama.py

Browse files
Files changed (1) hide show
  1. copyLLama.py +12 -0
copyLLama.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
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)