Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- game/engine.py +18 -9
game/engine.py
CHANGED
|
@@ -10,7 +10,7 @@ from game.state import collection_contains, mushroom_from_state, welcome_history
|
|
| 10 |
# Model configuration
|
| 11 |
# ---------------------------------------------------------------------------
|
| 12 |
|
| 13 |
-
DEFAULT_MODEL_ID = "
|
| 14 |
|
| 15 |
RARITY_WEIGHTS = {"Common": 64, "Rare": 24, "Legendary": 8}
|
| 16 |
RARITY_SCORE_VALUES = {"Common": 10, "Rare": 35, "Legendary": 100}
|
|
@@ -160,11 +160,16 @@ def _get_pipeline():
|
|
| 160 |
)
|
| 161 |
return _pipeline
|
| 162 |
except Exception as exc:
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
|
| 170 |
def companion_model_id():
|
|
@@ -173,12 +178,16 @@ def companion_model_id():
|
|
| 173 |
|
| 174 |
|
| 175 |
def companion_status():
|
| 176 |
-
"""Return a player-safe status line for the companion model."""
|
| 177 |
model = companion_model_id()
|
| 178 |
pipe = _get_pipeline()
|
|
|
|
| 179 |
if pipe:
|
| 180 |
-
return f"🧠 Myco AI:
|
| 181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
|
| 183 |
|
| 184 |
# Keep the old name so any code that calls hf_companion_status() still works.
|
|
|
|
| 10 |
# Model configuration
|
| 11 |
# ---------------------------------------------------------------------------
|
| 12 |
|
| 13 |
+
DEFAULT_MODEL_ID = "google/gemma-3-4b-it"
|
| 14 |
|
| 15 |
RARITY_WEIGHTS = {"Common": 64, "Rare": 24, "Legendary": 8}
|
| 16 |
RARITY_SCORE_VALUES = {"Common": 10, "Rare": 35, "Legendary": 100}
|
|
|
|
| 160 |
)
|
| 161 |
return _pipeline
|
| 162 |
except Exception as exc:
|
| 163 |
+
import traceback
|
| 164 |
+
|
| 165 |
+
print("\n========== MYCO MODEL LOAD ERROR ==========")
|
| 166 |
+
print(f"[Myco] Loading model: {model_id}")
|
| 167 |
+
traceback.print_exc()
|
| 168 |
+
print("==========================================\n")
|
| 169 |
+
print(f"[Myco] Successfully loaded: {model_id}")
|
| 170 |
+
|
| 171 |
+
_pipeline = False
|
| 172 |
+
return None
|
| 173 |
|
| 174 |
|
| 175 |
def companion_model_id():
|
|
|
|
| 178 |
|
| 179 |
|
| 180 |
def companion_status():
|
|
|
|
| 181 |
model = companion_model_id()
|
| 182 |
pipe = _get_pipeline()
|
| 183 |
+
|
| 184 |
if pipe:
|
| 185 |
+
return f"🧠 Myco AI: Gemma active ({model})"
|
| 186 |
+
|
| 187 |
+
return (
|
| 188 |
+
f"⚠️ Myco AI fallback mode "
|
| 189 |
+
f"(Gemma failed to load: {model})"
|
| 190 |
+
)
|
| 191 |
|
| 192 |
|
| 193 |
# Keep the old name so any code that calls hf_companion_status() still works.
|