Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- game/engine.py +7 -13
game/engine.py
CHANGED
|
@@ -139,19 +139,7 @@ MYSTERY_CHAPTERS = (
|
|
| 139 |
# ---------------------------------------------------------------------------
|
| 140 |
# Local pipeline — loaded once, reused for every reply
|
| 141 |
# ---------------------------------------------------------------------------
|
| 142 |
-
|
| 143 |
-
_pipeline = pipeline(
|
| 144 |
-
task="text-generation",
|
| 145 |
-
model=model_id,
|
| 146 |
-
token=os.getenv("HF_BUILD_SMALL_HACKATHON_TOKEN"),
|
| 147 |
-
torch_dtype="auto",
|
| 148 |
-
device_map="auto",
|
| 149 |
-
)
|
| 150 |
-
print(
|
| 151 |
-
"Token found:",
|
| 152 |
-
bool(os.getenv("HF_BUILD_SMALL_HACKATHON_TOKEN"))
|
| 153 |
-
)
|
| 154 |
-
|
| 155 |
|
| 156 |
def _get_pipeline():
|
| 157 |
"""Load the local transformers pipeline once and cache it."""
|
|
@@ -180,9 +168,15 @@ def _get_pipeline():
|
|
| 180 |
print(f"[Myco] Loading model: {model_id}")
|
| 181 |
print("===================================\n")
|
| 182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
_pipeline = pipeline(
|
| 184 |
task="text-generation",
|
| 185 |
model=model_id,
|
|
|
|
| 186 |
torch_dtype="auto",
|
| 187 |
device_map="auto",
|
| 188 |
)
|
|
|
|
| 139 |
# ---------------------------------------------------------------------------
|
| 140 |
# Local pipeline — loaded once, reused for every reply
|
| 141 |
# ---------------------------------------------------------------------------
|
| 142 |
+
_pipeline = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
|
| 144 |
def _get_pipeline():
|
| 145 |
"""Load the local transformers pipeline once and cache it."""
|
|
|
|
| 168 |
print(f"[Myco] Loading model: {model_id}")
|
| 169 |
print("===================================\n")
|
| 170 |
|
| 171 |
+
print(
|
| 172 |
+
"HF token found:",
|
| 173 |
+
bool(os.getenv("HF_BUILD_SMALL_HACKATHON_TOKEN"))
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
_pipeline = pipeline(
|
| 177 |
task="text-generation",
|
| 178 |
model=model_id,
|
| 179 |
+
token=os.getenv("HF_BUILD_SMALL_HACKATHON_TOKEN"),
|
| 180 |
torch_dtype="auto",
|
| 181 |
device_map="auto",
|
| 182 |
)
|