Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
168 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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}")
|