Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,13 +7,17 @@ import os
|
|
7 |
model_path = "rajj0/autotrain-phi3-midium-4k-godsent-orpo-6"
|
8 |
hf_token = os.getenv("HF_TOKEN") # Get the token from environment variables
|
9 |
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
12 |
model = AutoModelForCausalLM.from_pretrained(
|
13 |
model_path,
|
14 |
device_map="auto",
|
15 |
torch_dtype='auto',
|
16 |
-
use_auth_token=hf_token
|
|
|
17 |
).eval()
|
18 |
|
19 |
# Function to generate a response from the model
|
|
|
7 |
model_path = "rajj0/autotrain-phi3-midium-4k-godsent-orpo-6"
|
8 |
hf_token = os.getenv("HF_TOKEN") # Get the token from environment variables
|
9 |
|
10 |
+
if hf_token is None:
|
11 |
+
raise ValueError("HF_TOKEN environment variable not set")
|
12 |
+
|
13 |
+
# Load the tokenizer and model with trust_remote_code=True
|
14 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, use_auth_token=hf_token, trust_remote_code=True)
|
15 |
model = AutoModelForCausalLM.from_pretrained(
|
16 |
model_path,
|
17 |
device_map="auto",
|
18 |
torch_dtype='auto',
|
19 |
+
use_auth_token=hf_token,
|
20 |
+
trust_remote_code=True
|
21 |
).eval()
|
22 |
|
23 |
# Function to generate a response from the model
|