Spaces:
Runtime error
Runtime error
satishpednekar
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -45,22 +45,28 @@ def load_model_gpu():
|
|
45 |
return model, tokenizer
|
46 |
|
47 |
def load_model():
|
48 |
-
# Load in pure CPU mode without quantization
|
49 |
config = PeftConfig.from_pretrained("satishpednekar/sbx-qhelper-mistral-loraWeights")
|
50 |
|
51 |
model = AutoModelForCausalLM.from_pretrained(
|
52 |
config.base_model_name_or_path,
|
53 |
-
torch_dtype=torch.float32,
|
54 |
-
device_map=None,
|
55 |
trust_remote_code=True,
|
56 |
-
|
57 |
)
|
58 |
|
59 |
-
model = PeftModel.from_pretrained(
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
|
63 |
-
model = model.to("cpu")
|
64 |
|
65 |
return model, tokenizer
|
66 |
|
|
|
45 |
return model, tokenizer
|
46 |
|
47 |
def load_model():
|
|
|
48 |
config = PeftConfig.from_pretrained("satishpednekar/sbx-qhelper-mistral-loraWeights")
|
49 |
|
50 |
model = AutoModelForCausalLM.from_pretrained(
|
51 |
config.base_model_name_or_path,
|
52 |
+
torch_dtype=torch.float32,
|
53 |
+
device_map=None,
|
54 |
trust_remote_code=True,
|
55 |
+
# Remove all quantization-related parameters
|
56 |
)
|
57 |
|
58 |
+
model = PeftModel.from_pretrained(
|
59 |
+
model,
|
60 |
+
"satishpednekar/sbx-qhelper-mistral-loraWeights",
|
61 |
+
torch_dtype=torch.float32
|
62 |
+
)
|
63 |
+
|
64 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
65 |
+
config.base_model_name_or_path,
|
66 |
+
trust_remote_code=True
|
67 |
+
)
|
68 |
|
69 |
+
model = model.to("cpu").eval()
|
|
|
70 |
|
71 |
return model, tokenizer
|
72 |
|