Downloads · 30 days
25
6% of all-time downloads
jline/CLOVER-Qwen2.5-VL
CLOVER-Qwen2.5-VL is a machine learning model from jline. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
CLOVER-Qwen2.5-VL is an upgraded version of CLOVER, built upon Qwen2.5-VL, a powerful multimodal large language model for conversational pathology analysis. It efficiently adapts vision-language models (VLMs) to clini…
Downloads · 30 days
25
6% of all-time downloads
All-time downloads
392
Public
Parameters
8.3B
16.6 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors16.6 GB · 100%
From the Hugging Face model README
CLOVER-Qwen2.5-VL is an upgraded version of CLOVER, built upon Qwen2.5-VL, a powerful multimodal large language model for conversational pathology analysis. It efficiently adapts vision-language models (VLMs) to clinical domains with minimal computational cost while maintaining strong reasoning and question-answering capabilities.
🧾 This work is published in Nature Computational Science.
# Create environment
conda create -n clover python=3.10
conda activate clover
pip install torch==2.4.0 torchvision==0.19.0 --extra-index-url https://download.pytorch.org/whl/cu118
pip install transformers==4.52.4 accelerate qwen-vl-utils
from transformers import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
from qwen_vl_utils import process_vision_info
import torch
# default: Load the model and processer on the available device(s)
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
"jline/CLOVER-Qwen2.5-VL", torch_dtype=torch.bfloat16, device_map="auto"
)
processor = AutoProcessor.from_pretrained("jline/CLOVER-Qwen2.5-VL")
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "./image_path.png",
},
{"type": "text", "text": "Describe this image."},
],
}
]
# Preparation for inference
text = processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt",
)
inputs = inputs.to("cuda")
# Inference: Generation of the output
generated_ids = model.generate(**inputs, max_new_tokens=128)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)
If you find CLOVER useful for your research, please cite:
@article{chen2025cost,
title={Cost-effective instruction learning for pathology vision and language analysis},
author={Chen, K. and Liu, M. and Yan, F. and others},
journal={Nature Computational Science},
year={2025},
doi={10.1038/s43588-025-00818-5}
}