Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -9,10 +9,13 @@ MODEL_ID = "IFM/K2-Horizon-0.9B-GGUF"
|
|
| 9 |
@spaces.GPU(duration=60)
|
| 10 |
def load_model():
|
| 11 |
"""Load the model and tokenizer with proper config handling."""
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
# If model_type is not set, set it based on the architecture
|
| 16 |
if not hasattr(config, "model_type") or config.model_type is None:
|
| 17 |
config.model_type = "k2_horizon"
|
| 18 |
|
|
|
|
| 9 |
@spaces.GPU(duration=60)
|
| 10 |
def load_model():
|
| 11 |
"""Load the model and tokenizer with proper config handling."""
|
| 12 |
+
try:
|
| 13 |
+
config = AutoConfig.from_pretrained(MODEL_ID, trust_remote_code=True)
|
| 14 |
+
except ValueError:
|
| 15 |
+
# Model config doesn't have model_type, set it manually
|
| 16 |
+
config = AutoConfig.for_model("k2_horizon")
|
| 17 |
+
config.is_encoder_decoder = False
|
| 18 |
|
|
|
|
| 19 |
if not hasattr(config, "model_type") or config.model_type is None:
|
| 20 |
config.model_type = "k2_horizon"
|
| 21 |
|