Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,16 @@
|
|
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 |
|
|
|
1 |
import os
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
|
4 |
+
|
5 |
+
# Retrieve the token from the environment variable
|
6 |
+
hf_api_token = os.getenv("HF_API_TOKEN")
|
7 |
+
|
8 |
+
if hf_api_token is None:
|
9 |
+
raise ValueError("HF_API_TOKEN environment variable is not set")
|
10 |
+
|
11 |
+
# Authenticate with Hugging Face
|
12 |
+
login(token=hf_api_token, add_to_git_credential=True)
|
13 |
+
|
14 |
# Define the local directory where the model will be saved
|
15 |
local_model_dir = "./llama-2-7b-hf"
|
16 |
|