rajj0 commited on
Commit
8766425
·
verified ·
1 Parent(s): e6db111

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
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
- # Load the tokenizer and model
11
- tokenizer = AutoTokenizer.from_pretrained(model_path, use_auth_token=hf_token)
 
 
 
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