Spaces:
Sleeping
Sleeping
adding HF token
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ Two-stage hierarchical cascade:
|
|
| 8 |
Models were trained on APS PhySH labels with google/embeddinggemma-300m embeddings.
|
| 9 |
"""
|
| 10 |
|
|
|
|
| 11 |
import re
|
| 12 |
from pathlib import Path
|
| 13 |
from typing import Dict, List, Tuple
|
|
@@ -94,7 +95,10 @@ def load_models():
|
|
| 94 |
device = "cpu"
|
| 95 |
|
| 96 |
print(f"Loading embedding model ({EMBEDDING_MODEL_NAME}) on {device} …")
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
# --- discipline model ---
|
| 100 |
disc_ckpt = torch.load(DISCIPLINE_MODEL_PATH, map_location=device, weights_only=False)
|
|
|
|
| 8 |
Models were trained on APS PhySH labels with google/embeddinggemma-300m embeddings.
|
| 9 |
"""
|
| 10 |
|
| 11 |
+
import os
|
| 12 |
import re
|
| 13 |
from pathlib import Path
|
| 14 |
from typing import Dict, List, Tuple
|
|
|
|
| 95 |
device = "cpu"
|
| 96 |
|
| 97 |
print(f"Loading embedding model ({EMBEDDING_MODEL_NAME}) on {device} …")
|
| 98 |
+
hf_token = os.environ.get("HF_TOKEN")
|
| 99 |
+
embedding_model = SentenceTransformer(
|
| 100 |
+
EMBEDDING_MODEL_NAME, device=device, token=hf_token,
|
| 101 |
+
)
|
| 102 |
|
| 103 |
# --- discipline model ---
|
| 104 |
disc_ckpt = torch.load(DISCIPLINE_MODEL_PATH, map_location=device, weights_only=False)
|