Tapash250 commited on
Commit
c69def0
·
verified ·
1 Parent(s): 5b20258

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +6 -3
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
- # Load config first to check model_type
13
- config = AutoConfig.from_pretrained(MODEL_ID, trust_remote_code=True)
 
 
 
 
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