Spaces:
Sleeping

byte-vortex commited on
Commit
9067def
·
verified ·
1 Parent(s): eb67377

Deploy Myco from CI

Browse files
Files changed (1) hide show
  1. 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 = "openai/gpt-oss-20b"
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
- # If the model cannot be loaded (e.g. not enough VRAM on this machine),
164
- # log once and keep _pipeline as None so the fallback voice is used.
165
- print(f"[Myco] Could not load local pipeline: {exc}")
166
- _pipeline = False # sentinel: we already tried and failed
167
- return None
 
 
 
 
 
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: running locally with `{model}`."
181
- return f"🧠 Myco AI: fallback voice active (could not load `{model}`)."
 
 
 
 
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.