Instructions to use TomoroAI/tomoro-colqwen3-embed-4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TomoroAI/tomoro-colqwen3-embed-4b with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("TomoroAI/tomoro-colqwen3-embed-4b", trust_remote_code=True, device_map="auto") - sentence-transformers
How to use TomoroAI/tomoro-colqwen3-embed-4b with sentence-transformers:
from sentence_transformers import MultiVectorEncoder model = MultiVectorEncoder("TomoroAI/tomoro-colqwen3-embed-4b", trust_remote_code=True) queries = ["Which planet is known as the Red Planet?"] documents = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", ] query_embeddings = model.encode_query(queries) document_embeddings = model.encode_document(documents) similarities = model.similarity(query_embeddings, document_embeddings) print(similarities) - ColPali
How to use TomoroAI/tomoro-colqwen3-embed-4b 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
AttributeError: 'ColQwen3Config' object has no attribute 'text_config' on load (after separately hitting a mutable-default dataclass bug)
AttributeError: 'ColQwen3Config' object has no attribute 'text_config' on load
Trying to load this model per the README's Inference Code example fails during config instantiation.
Environment: Python 3.14, transformers 5.9.0 and 5.14.1 (both tested, identical failure), torch 2.13.0, Linux.
Steps to reproduce
from transformers import AutoModel, AutoProcessor
processor = AutoProcessor.from_pretrained(
"TomoroAI/tomoro-colqwen3-embed-4b", trust_remote_code=True, max_num_visual_tokens=1280
)
Issue 1 (worked around locally)
configuration_colqwen3.py line 35 sets sub_configs: dict[str, Any] = {...} as a bare dict default on a dataclass-decorated PretrainedConfig subclass, which Python's dataclasses module rejects:
ValueError: mutable default <class 'dict'> for field sub_configs is not allowed: use default_factory
Wrapping it in field(default_factory=lambda: {...}) resolves this specific error.
Full traceback for Issue 1 (click to expand)
File ".../configuration_colqwen3.py", line 31, in <module>
class ColQwen3Config(PretrainedConfig):
...<75 lines>...
return self.text_config
File ".../transformers/configuration_utils.py", line 316, in __init_subclass__
cls = dataclass(cls, repr=False, kw_only=True)
File "/usr/lib/python3.14/dataclasses.py", line 1450, in dataclass
return wrap(cls)
File "/usr/lib/python3.14/dataclasses.py", line 917, in _get_field
raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'dict'> for field sub_configs is not allowed: use default_factory
Issue 2 (blocking, no workaround found)
After patching Issue 1, DEFAULT_CONFIG = ColQwen3Config() at module load time fails with:
AttributeError: 'ColQwen3Config' object has no attribute 'text_config'. Did you mean: 'get_text_config'?
This happens inside transformers' validate_token_ids, which calls self.get_text_config(), which returns self.text_config — but nothing in ColQwen3Config.__init__ appears to actually set self.text_config from sub_configs before super().__init__(**kwargs) runs validation.
Reproduced identically on two transformers versions three months apart (5.9.0 and 5.14.1), so it doesn't look version-specific.
Full traceback for Issue 2 (click to expand)
File ".../configuration_colqwen3.py", line 111, in <module>
DEFAULT_CONFIG = ColQwen3Config()
File ".../configuration_colqwen3.py", line 74, in __init__
super().__init__(**kwargs)
File ".../huggingface_hub/dataclasses.py", line 276, in init_with_validate
cls.validate(self)
File ".../huggingface_hub/dataclasses.py", line 251, in validate
validator(self)
File ".../transformers/configuration_utils.py", line 458, in validate_token_ids
text_config = self.get_text_config(decoder=True)
File ".../configuration_colqwen3.py", line 108, in get_text_config
return self.text_config
File ".../transformers/configuration_utils.py", line 434, in __getattribute__
return super().__getattribute__(key)
AttributeError: 'ColQwen3Config' object has no attribute 'text_config'. Did you mean: 'get_text_config'?
Happy to share the full patch script or more environment details if useful. Is there a known-good transformers pin, or a fix planned for configuration_colqwen3.py's __init__?
Hi, the latest PR should have fixed the issue with latest transfomer version.