teamaMohamed115 commited on
Commit
f0b1102
·
verified ·
1 Parent(s): 28c89fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -13,10 +13,13 @@ print(f"Loading tokenizer and model from {MODEL_ID} on {DEVICE}")
13
 
14
 
15
  tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, use_fast=True)
16
- # If the model was pushed with custom config (like trusting remote code), we handle gracefully
17
- model = AutoModelForCausalLM.from_pretrained(MODEL_ID, trust_remote_code=True)
 
 
18
  except Exception:
19
- model = AutoModelForCausalLM.from_pretrained(MODEL_ID)
 
20
 
21
 
22
  model.to(DEVICE)
 
13
 
14
 
15
  tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, use_fast=True)
16
+
17
+ # Safe loader
18
+ try:
19
+ model = AutoModelForCausalLM.from_pretrained(MODEL_ID, trust_remote_code=True)
20
  except Exception:
21
+ model = AutoModelForCausalLM.from_pretrained(MODEL_ID)
22
+
23
 
24
 
25
  model.to(DEVICE)