Visual Document Retrieval
Transformers
Safetensors
sentence-transformers
ColPali
multilingual
colqwen3
feature-extraction
multi-vector
text
image
video
multimodal-embedding
vidore
multilingual-embedding
custom_code
Instructions to use TomoroAI/tomoro-colqwen3-embed-8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TomoroAI/tomoro-colqwen3-embed-8b with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("TomoroAI/tomoro-colqwen3-embed-8b", trust_remote_code=True, device_map="auto") - sentence-transformers
How to use TomoroAI/tomoro-colqwen3-embed-8b with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("TomoroAI/tomoro-colqwen3-embed-8b", trust_remote_code=True) sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - ColPali
How to use TomoroAI/tomoro-colqwen3-embed-8b with ColPali:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Complete Transformers 5.x multimodal and save support (#2)
Browse files- Complete Transformers 5.x multimodal and save support (c27010395083d85570830cd469c545e582b33076)
- Fix Transformers 5 tied-weight save mapping (6030c5ce87f00639f2d8e3461954bbaacdb3a0eb)
- modeling_colqwen3.py +4 -1
- processing_colqwen3.py +2 -4
modeling_colqwen3.py
CHANGED
|
@@ -139,7 +139,10 @@ class ColQwen3(ColQwen3PreTrainedModel):
|
|
| 139 |
)
|
| 140 |
self.padding_side = getattr(config, "padding_side", "left")
|
| 141 |
self.mask_non_image_embeddings = mask_non_image_embeddings
|
| 142 |
-
|
|
|
|
|
|
|
|
|
|
| 143 |
|
| 144 |
self.post_init()
|
| 145 |
|
|
|
|
| 139 |
)
|
| 140 |
self.padding_side = getattr(config, "padding_side", "left")
|
| 141 |
self.mask_non_image_embeddings = mask_non_image_embeddings
|
| 142 |
+
inner_tied = self.vlm._tied_weights_keys or {}
|
| 143 |
+
self._tied_weights_keys = {
|
| 144 |
+
f"vlm.{target}": f"vlm.{source}" for target, source in inner_tied.items()
|
| 145 |
+
}
|
| 146 |
|
| 147 |
self.post_init()
|
| 148 |
|
processing_colqwen3.py
CHANGED
|
@@ -57,6 +57,7 @@ class ColQwen3ProcessorKwargs(ProcessingKwargs, total=False):
|
|
| 57 |
_defaults = {
|
| 58 |
"text_kwargs": {
|
| 59 |
"padding": "longest",
|
|
|
|
| 60 |
},
|
| 61 |
"images_kwargs": {
|
| 62 |
"data_format": "channels_first",
|
|
@@ -401,10 +402,7 @@ class ColQwen3Processor(ProcessorMixin):
|
|
| 401 |
self._check_special_mm_tokens(text_prompts, text_inputs, modalities=["image", "video"])
|
| 402 |
|
| 403 |
if return_mm_token_type_ids:
|
| 404 |
-
|
| 405 |
-
mm_token_type_ids = np.zeros_like(text_inputs["input_ids"])
|
| 406 |
-
mm_token_type_ids[array_ids == self.image_token_id] = 1
|
| 407 |
-
text_inputs["mm_token_type_ids"] = mm_token_type_ids.tolist()
|
| 408 |
|
| 409 |
return BatchFeature(data={**text_inputs, **image_inputs, **videos_inputs}, tensor_type=return_tensors)
|
| 410 |
|
|
|
|
| 57 |
_defaults = {
|
| 58 |
"text_kwargs": {
|
| 59 |
"padding": "longest",
|
| 60 |
+
"return_mm_token_type_ids": True,
|
| 61 |
},
|
| 62 |
"images_kwargs": {
|
| 63 |
"data_format": "channels_first",
|
|
|
|
| 402 |
self._check_special_mm_tokens(text_prompts, text_inputs, modalities=["image", "video"])
|
| 403 |
|
| 404 |
if return_mm_token_type_ids:
|
| 405 |
+
text_inputs["mm_token_type_ids"] = self.create_mm_token_type_ids(text_inputs["input_ids"])
|
|
|
|
|
|
|
|
|
|
| 406 |
|
| 407 |
return BatchFeature(data={**text_inputs, **image_inputs, **videos_inputs}, tensor_type=return_tensors)
|
| 408 |
|