Neon-AI commited on
Commit
c2591a8
·
verified ·
1 Parent(s): a51ee55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -27,21 +27,16 @@ def load_model():
27
  trust_remote_code=True
28
  )
29
 
30
- base_model = AutoModelForCausalLM.from_pretrained(
31
  MODEL_ID,
32
- torch_dtype=torch.float32,
33
- device_map=None
34
  )
35
 
36
- # Load LoRA if present
37
- try:
38
- model = PeftModel.from_pretrained(base_model, MODEL_ID)
39
- except Exception:
40
- model = base_model
41
 
42
- print(model.peft_config)
43
-
44
- model.to("cpu")
45
  model.eval()
46
  return tokenizer, model
47
 
 
27
  trust_remote_code=True
28
  )
29
 
30
+ model = AutoModelForCausalLM.from_pretrained(
31
  MODEL_ID,
32
+ dtype=torch.float32,
33
+ device_map="cpu" # explicit
34
  )
35
 
36
+ # DO NOT wrap with PeftModel again
37
+ if hasattr(model, "peft_config"):
38
+ print("LoRA detected and loaded once ✅")
 
 
39
 
 
 
 
40
  model.eval()
41
  return tokenizer, model
42