Twelve2five commited on
Commit
9295d60
·
verified ·
1 Parent(s): fe289fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -164,9 +164,18 @@ def load_model():
164
 
165
  print(f"Model loaded on device: cuda:{gpu_id}")
166
 
167
- # Load tokenizer as well
168
- tokenizer = AutoTokenizer.from_pretrained(hf_model_repo_id)
169
- print(f"Loaded model vocab size: {len(tokenizer)}")
 
 
 
 
 
 
 
 
 
170
 
171
  # Print information about input embeddings
172
  print(f"Input embedding shape: {model.get_input_embeddings().weight.shape}")
 
164
 
165
  print(f"Model loaded on device: cuda:{gpu_id}")
166
 
167
+ # Load the official Meta tokenizer for LLaMA 3
168
+ tokenizer = AutoTokenizer.from_pretrained(
169
+ "meta-llama/Llama-3-8B", # Use the official Meta tokenizer
170
+ use_auth_token=os.environ.get("HF_TOKEN", None) # In case it's needed
171
+ )
172
+
173
+ if tokenizer is None:
174
+ # Fallback to another common foundation model tokenizer
175
+ print("Falling back to another tokenizer as Meta tokenizer requires auth token")
176
+ tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
177
+
178
+ print(f"Loaded tokenizer vocabulary size: {len(tokenizer)}")
179
 
180
  # Print information about input embeddings
181
  print(f"Input embedding shape: {model.get_input_embeddings().weight.shape}")