Update app.py
Browse files
app.py
CHANGED
@@ -27,14 +27,14 @@ def generate_and_export():
|
|
27 |
On button click: lazily load the 8‑bit model, generate 100 doc→SOAP pairs,
|
28 |
split 70/30, run inference & eval, write files, and return download links.
|
29 |
"""
|
30 |
-
# a) Load full model in 8‑bit
|
31 |
model = AutoModelForImageTextToText.from_pretrained(
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
38 |
device = next(model.parameters()).device
|
39 |
|
40 |
def to_soap(text: str) -> str:
|
|
|
27 |
On button click: lazily load the 8‑bit model, generate 100 doc→SOAP pairs,
|
28 |
split 70/30, run inference & eval, write files, and return download links.
|
29 |
"""
|
|
|
30 |
model = AutoModelForImageTextToText.from_pretrained(
|
31 |
+
MODEL_ID,
|
32 |
+
trust_remote_code=True,
|
33 |
+
token=HF_TOKEN,
|
34 |
+
torch_dtype=torch.float16, # or torch.float32 if you prefer
|
35 |
+
device_map="auto"
|
36 |
+
)
|
37 |
+
|
38 |
device = next(model.parameters()).device
|
39 |
|
40 |
def to_soap(text: str) -> str:
|