Skip to content

Commit 3adb8b8

Browse files
authored
completely add liquid-vl models
1 parent 5794c79 commit 3adb8b8

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

src/constants.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,20 @@
750750
}
751751

752752
VISION_MODELS = {
753-
'Liquid-VL - 1.6B': {# transformers 4.48.3
753+
'Liquid-VL - 480M': {
754+
'precision': 'bfloat16',
755+
'quant': 'n/a',
756+
'size': '480m',
757+
'repo_id': 'LiquidAI/LFM2-VL-450M',
758+
'cache_dir': 'LiquidAI--LFM2-VL-450M',
759+
'requires_cuda': False,
760+
'vram': '628 MB',
761+
'speed': '497.64 char/s',
762+
'avg_length': 964,
763+
'loader': 'loader_liquidvl',
764+
'license': 'lfm1.0',
765+
},
766+
'Liquid-VL - 1.6B': {
754767
'precision': 'bfloat16',
755768
'quant': 'n/a',
756769
'size': '1.6b',
@@ -759,7 +772,8 @@
759772
'requires_cuda': False,
760773
'vram': '1.4 GB',
761774
'speed': '437.5 char/s',
762-
'loader': 'loader_internvl',
775+
'avg_length': 856,
776+
'loader': 'loader_liquidvl',
763777
'license': 'lfm1.0',
764778
},
765779
'InternVL3 - 1b': {# transformers 4.48.3
@@ -770,6 +784,7 @@
770784
'cache_dir': 'OpenGVLab--InternVL3-1B',
771785
'requires_cuda': False,
772786
'vram': '2.4 GB',
787+
'avg_length': 527,
773788
'loader': 'loader_internvl',
774789
'license': 'apache-2.0',
775790
},
@@ -792,6 +807,7 @@
792807
'cache_dir': 'OpenGVLab--InternVL3-2B',
793808
'requires_cuda': False,
794809
'vram': '3.2 GB',
810+
'avg_length': 560,
795811
'loader': 'loader_internvl',
796812
'license': 'apache-2.0',
797813
},
@@ -825,6 +841,7 @@
825841
'cache_dir': 'Qwen--Qwen2.5-VL-3B-Instruct',
826842
'requires_cuda': True,
827843
'vram': '6.3 GB',
844+
'avg_length': 668,
828845
'loader': 'loader_qwenvl',
829846
'license': 'Custom Non-Commercial',
830847
},
@@ -836,6 +853,7 @@
836853
'cache_dir': 'OpenGVLab--InternVL3-8B',
837854
'requires_cuda': True,
838855
'vram': '8.2 GB',
856+
'avg_length': 743,
839857
'loader': 'loader_internvl',
840858
'license': 'apache-2.0',
841859
},
@@ -847,6 +865,7 @@
847865
'cache_dir': 'Qwen--Qwen2.5-VL-7B-Instruct',
848866
'requires_cuda': True,
849867
'vram': '9.6 GB',
868+
'avg_length': 577,
850869
'loader': 'loader_qwenvl',
851870
'license': 'Custom Non-Commercial',
852871
},

src/module_process_images.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def run_loader_in_process(loader_func):
6363
my_cprint(error_message, "red")
6464
return []
6565

66+
6667
def choose_image_loader():
6768
with open('config.yaml', 'r') as file:
6869
config = yaml.safe_load(file)
@@ -81,7 +82,7 @@ def choose_image_loader():
8182
loader_func = loader_qwenvl(config).process_images
8283
elif chosen_model == 'GLM-4.1V-9B-Thinking':
8384
loader_func = loader_glmv4_thinking(config).process_images
84-
elif chosen_model in ['Liquid-VL - 1.6B']:
85+
elif chosen_model in ['Liquid-VL - 1.6B', 'Liquid-VL - 480M']:
8586
loader_func = loader_liquidvl(config).process_images
8687
else:
8788
my_cprint("No valid image model specified in config.yaml", "red")
@@ -641,14 +642,14 @@ def initialize_model_and_tokenizer(self):
641642
model.eval()
642643

643644
precision_str = "bfloat16" if use_bf16 else "float16"
644-
device_str = device_str_from_model(model, fallback_device=self.device)
645+
device_str = "CUDA" if self.device == "cuda" else "CPU"
645646
my_cprint(f"{chosen_model} loaded into memory on {device_str} ({precision_str})", "green")
646647

647648
return model, None, processor
648649

649650
@torch.inference_mode()
650651
def process_single_image(self, raw_image):
651-
user_message = "Describe in as much detail as possible what this image depicts?"
652+
user_message = "Explain everything you see in this picture but your response should be no more than one paragraph, but the paragraph can be as long as you want."
652653
prompt = (
653654
"<|im_start|>user\n"
654655
f"{user_message} <|vis_start|><|image_pad|><|vis_end|>\n"

0 commit comments

Comments
 (0)