Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -52,19 +52,19 @@ print("Using device:", device)
|
|
52 |
MODEL_ID_M = "LiquidAI/LFM2-VL-450M"
|
53 |
processor_m = AutoProcessor.from_pretrained(MODEL_ID_M, trust_remote_code=True)
|
54 |
model_m = AutoModelForImageTextToText.from_pretrained(
|
55 |
-
MODEL_ID_M, trust_remote_code=True, torch_dtype=torch.
|
56 |
).to(device).eval()
|
57 |
|
58 |
MODEL_ID_T = "LiquidAI/LFM2-VL-1.6B"
|
59 |
processor_t = AutoProcessor.from_pretrained(MODEL_ID_T, trust_remote_code=True)
|
60 |
model_t = AutoModelForImageTextToText.from_pretrained(
|
61 |
-
MODEL_ID_T, trust_remote_code=True, torch_dtype=torch.
|
62 |
).to(device).eval()
|
63 |
|
64 |
MODEL_ID_C = "HuggingFaceTB/SmolVLM-Instruct-250M"
|
65 |
processor_c = AutoProcessor.from_pretrained(MODEL_ID_C, trust_remote_code=True)
|
66 |
model_c = AutoModelForVision2Seq.from_pretrained(
|
67 |
-
MODEL_ID_C, trust_remote_code=True, torch_dtype=torch.
|
68 |
).to(device).eval()
|
69 |
|
70 |
MODEL_ID_G = "echo840/MonkeyOCR"
|
@@ -73,13 +73,13 @@ processor_g = AutoProcessor.from_pretrained(
|
|
73 |
MODEL_ID_G, trust_remote_code=True, subfolder=SUBFOLDER
|
74 |
)
|
75 |
model_g = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
76 |
-
MODEL_ID_G, trust_remote_code=True, subfolder=SUBFOLDER, torch_dtype=torch.
|
77 |
).to(device).eval()
|
78 |
|
79 |
MODEL_ID_I = "HuggingFaceTB/SmolVLM2-2.2B-Instruct"
|
80 |
processor_i = AutoProcessor.from_pretrained(MODEL_ID_I, trust_remote_code=True)
|
81 |
model_i = AutoModelForImageTextToText.from_pretrained(
|
82 |
-
MODEL_ID_I, trust_remote_code=True, torch_dtype=torch.
|
83 |
).to(device).eval()
|
84 |
|
85 |
|
|
|
52 |
MODEL_ID_M = "LiquidAI/LFM2-VL-450M"
|
53 |
processor_m = AutoProcessor.from_pretrained(MODEL_ID_M, trust_remote_code=True)
|
54 |
model_m = AutoModelForImageTextToText.from_pretrained(
|
55 |
+
MODEL_ID_M, trust_remote_code=True, torch_dtype=torch.float16
|
56 |
).to(device).eval()
|
57 |
|
58 |
MODEL_ID_T = "LiquidAI/LFM2-VL-1.6B"
|
59 |
processor_t = AutoProcessor.from_pretrained(MODEL_ID_T, trust_remote_code=True)
|
60 |
model_t = AutoModelForImageTextToText.from_pretrained(
|
61 |
+
MODEL_ID_T, trust_remote_code=True, torch_dtype=torch.float16
|
62 |
).to(device).eval()
|
63 |
|
64 |
MODEL_ID_C = "HuggingFaceTB/SmolVLM-Instruct-250M"
|
65 |
processor_c = AutoProcessor.from_pretrained(MODEL_ID_C, trust_remote_code=True)
|
66 |
model_c = AutoModelForVision2Seq.from_pretrained(
|
67 |
+
MODEL_ID_C, trust_remote_code=True, torch_dtype=torch.float16, _attn_implementation="flash_attention_2"
|
68 |
).to(device).eval()
|
69 |
|
70 |
MODEL_ID_G = "echo840/MonkeyOCR"
|
|
|
73 |
MODEL_ID_G, trust_remote_code=True, subfolder=SUBFOLDER
|
74 |
)
|
75 |
model_g = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
76 |
+
MODEL_ID_G, trust_remote_code=True, subfolder=SUBFOLDER, torch_dtype=torch.float16
|
77 |
).to(device).eval()
|
78 |
|
79 |
MODEL_ID_I = "HuggingFaceTB/SmolVLM2-2.2B-Instruct"
|
80 |
processor_i = AutoProcessor.from_pretrained(MODEL_ID_I, trust_remote_code=True)
|
81 |
model_i = AutoModelForImageTextToText.from_pretrained(
|
82 |
+
MODEL_ID_I, trust_remote_code=True, torch_dtype=torch.float16, _attn_implementation="flash_attention_2"
|
83 |
).to(device).eval()
|
84 |
|
85 |
|