raygiles3 commited on
Commit
dac5c38
1 Parent(s): b137f9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -1,3 +1,12 @@
1
- import gradio as gr
 
2
 
3
- gr.load("models/meta-llama/Llama-2-7b-hf").launch()
 
 
 
 
 
 
 
 
 
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)