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