Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,21 @@
|
|
| 1 |
-
from transformers import
|
| 2 |
-
import torch
|
| 3 |
|
| 4 |
MODEL_ID = "savan360/Qwen_prompt_creator"
|
| 5 |
-
SUBFOLDER = "merged" # or "adapter" if you’re using the LoRA route
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
|
|
|
| 11 |
model = AutoModelForCausalLM.from_pretrained(
|
| 12 |
MODEL_ID,
|
| 13 |
-
|
| 14 |
-
dtype=torch.float16, # <- replaces deprecated torch_dtype
|
| 15 |
-
device_map="auto",
|
| 16 |
trust_remote_code=True,
|
| 17 |
-
|
|
|
|
| 18 |
)
|
|
|
|
| 1 |
+
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
|
|
|
|
| 2 |
|
| 3 |
MODEL_ID = "savan360/Qwen_prompt_creator"
|
|
|
|
| 4 |
|
| 5 |
+
cfg = AutoConfig.from_pretrained(MODEL_ID, trust_remote_code=True)
|
| 6 |
+
|
| 7 |
+
# ---- PATCH: remove/normalize bad quantization_config ----
|
| 8 |
+
if hasattr(cfg, "quantization_config"):
|
| 9 |
+
qc = getattr(cfg, "quantization_config")
|
| 10 |
+
if qc is None:
|
| 11 |
+
# remove the attribute entirely; from_pretrained doesn't need it if you're not quantizing via HF APIs
|
| 12 |
+
delattr(cfg, "quantization_config")
|
| 13 |
|
| 14 |
+
tok = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
|
| 15 |
model = AutoModelForCausalLM.from_pretrained(
|
| 16 |
MODEL_ID,
|
| 17 |
+
config=cfg,
|
|
|
|
|
|
|
| 18 |
trust_remote_code=True,
|
| 19 |
+
torch_dtype="auto",
|
| 20 |
+
device_map="auto",
|
| 21 |
)
|