Improve language tag (#2)
Browse files- Improve language tag (cd350a83818a1db26253a72502edce712a7eda1e)
Co-authored-by: Loïck BOURDOIS <[email protected]>
README.md
CHANGED
|
@@ -1,88 +1,102 @@
|
|
| 1 |
-
---
|
| 2 |
-
base_model:
|
| 3 |
-
- Qwen/Qwen2.5-0.5B-Instruct
|
| 4 |
-
license: apache-2.0
|
| 5 |
-
pipeline_tag: image-text-to-text
|
| 6 |
-
library_name: slimm
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
-
|
| 19 |
-
-
|
| 20 |
-
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
#
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model:
|
| 3 |
+
- Qwen/Qwen2.5-0.5B-Instruct
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
pipeline_tag: image-text-to-text
|
| 6 |
+
library_name: slimm
|
| 7 |
+
language:
|
| 8 |
+
- zho
|
| 9 |
+
- eng
|
| 10 |
+
- fra
|
| 11 |
+
- spa
|
| 12 |
+
- por
|
| 13 |
+
- deu
|
| 14 |
+
- ita
|
| 15 |
+
- rus
|
| 16 |
+
- jpn
|
| 17 |
+
- kor
|
| 18 |
+
- vie
|
| 19 |
+
- tha
|
| 20 |
+
- ara
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
# Model Card for CoMP-MM-1B
|
| 24 |
+
|
| 25 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
| 26 |
+
This is an LMM that supports **native image resolution inputs**, composed of [CoMP-SigLIP](https://huggingface.co/SliMM-X/CoMP-SigLIP-So400M) and [Qwen2.5](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct).
|
| 27 |
+
|
| 28 |
+
## Model Sources
|
| 29 |
+
|
| 30 |
+
<!-- Provide the basic links for the model. -->
|
| 31 |
+
|
| 32 |
+
- **Repository:** https://github.com/SliMM-X/CoMP-MM
|
| 33 |
+
- **Paper:** https://arxiv.org/abs/2503.18931
|
| 34 |
+
- **Project Page:** https://slimm-x.github.io/comp
|
| 35 |
+
|
| 36 |
+
## How to Get Started with the Model
|
| 37 |
+
|
| 38 |
+
Install the github repo, and use the code below to get started with the model.
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
# this is very similar to qwen2-vl
|
| 42 |
+
from slimm.model.processor import SliMMQwen2VLProcessor
|
| 43 |
+
from slimm.model.slimm import SliMMForConditionalGeneration
|
| 44 |
+
from slimm.model.utils_vl import process_vision_info
|
| 45 |
+
|
| 46 |
+
model_path = "SliMM-X/CoMP-MM-1B"
|
| 47 |
+
|
| 48 |
+
model = SliMMForConditionalGeneration.from_pretrained(
|
| 49 |
+
model_path, torch_dtype="auto", device_map="cuda"
|
| 50 |
+
)
|
| 51 |
+
processor = SliMMQwen2VLProcessor.from_pretrained(model_path)
|
| 52 |
+
|
| 53 |
+
messages = [
|
| 54 |
+
{
|
| 55 |
+
"role": "user",
|
| 56 |
+
"content": [
|
| 57 |
+
{
|
| 58 |
+
"type": "image",
|
| 59 |
+
"image": "https://slimm-x.github.io/comp/figs/teaser.png",
|
| 60 |
+
},
|
| 61 |
+
{"type": "text", "text": "Describe this image."},
|
| 62 |
+
],
|
| 63 |
+
}
|
| 64 |
+
]
|
| 65 |
+
|
| 66 |
+
# Preparation for inference
|
| 67 |
+
text = processor.apply_chat_template(
|
| 68 |
+
messages, tokenize=False, add_generation_prompt=True
|
| 69 |
+
)
|
| 70 |
+
image_inputs, video_inputs = process_vision_info(messages)
|
| 71 |
+
inputs = processor(
|
| 72 |
+
text=[text],
|
| 73 |
+
images=image_inputs,
|
| 74 |
+
videos=video_inputs,
|
| 75 |
+
padding=True,
|
| 76 |
+
return_tensors="pt",
|
| 77 |
+
)
|
| 78 |
+
inputs = inputs.to("cuda")
|
| 79 |
+
|
| 80 |
+
# Inference: Generation of the output
|
| 81 |
+
generated_ids = model.generate(**inputs, max_new_tokens=128)
|
| 82 |
+
generated_ids_trimmed = [
|
| 83 |
+
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
| 84 |
+
]
|
| 85 |
+
output_text = processor.batch_decode(
|
| 86 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
| 87 |
+
)
|
| 88 |
+
print(output_text)
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
## Citation
|
| 92 |
+
|
| 93 |
+
**BibTeX:**
|
| 94 |
+
|
| 95 |
+
```bibtex
|
| 96 |
+
@article{comp2025,
|
| 97 |
+
title={CoMP: Continual Multimodal Pre-training for Vision Foundation Models},
|
| 98 |
+
author={Chen, Yitong and Meng, Lingchen and Peng, Wujian and Wu, Zuxuan and Jiang, Yu-Gang},
|
| 99 |
+
year={2025},
|
| 100 |
+
journal={arXiv preprint arXiv:2503.18931},
|
| 101 |
+
}
|
| 102 |
```
|