Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,24 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
|
5 |
# Load model and tokenizer
|
6 |
model_name = "meta-llama/Llama-2-7b-chat-hf"
|
7 |
print("started loading model")
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
print("loaded model")
|
10 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
11 |
print("loaded tokenizer")
|
|
|
5 |
# Load model and tokenizer
|
6 |
model_name = "meta-llama/Llama-2-7b-chat-hf"
|
7 |
print("started loading model")
|
8 |
+
|
9 |
+
api_token = "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" # Replace with your actual API token
|
10 |
+
|
11 |
+
model = AutoModelForCausalLM.from_pretrained(
|
12 |
+
model_name,
|
13 |
+
low_cpu_mem_usage=True,
|
14 |
+
return_dict=True,
|
15 |
+
torch_dtype=torch.float16,
|
16 |
+
revision="main", # Or the desired revision
|
17 |
+
auth_token=api_token # Provide the API token here
|
18 |
+
)
|
19 |
+
|
20 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
21 |
+
model_name,
|
22 |
+
revision="main", # Or the desired revision
|
23 |
+
auth_token=api_token # Provide the API token here
|
24 |
+
)
|
25 |
+
|
26 |
print("loaded model")
|
27 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
28 |
print("loaded tokenizer")
|