đ AltCLIP-m9
AltCLIP-m9 supports multiple languages, including English (En), Chinese (Zh), Spanish (Es), French (Fr), Russian (Ru), Japanese (Ja), Korean (Ko), Arabic (Ar), and Italian (It). It offers a powerful solution for text - image tasks in a multilingual context.
Name |
Task |
Languages |
Model |
Github |
AltCLIP-m9 |
Text - Image |
Multilingual |
CLIP |
FlagAI |
đ Quick Start
AltCLIP-m9 is a multilingual CLIP model. You can find the model code on FlagAI and the model weights on modelhub. We also provide scripts for fine - tuning, inference, and validation.
⨠Features
- Multilingual Support: AltCLIP-m9 supports nine languages, enabling text - image tasks across different language communities.
- Efficient Training Method: We propose a simple and efficient method to train this multilingual CLIP model.
đ Documentation
Brief Introduction
We propose a simple and efficient method to train a better multilingual CLIP model, named AltCLIP-m9. The training data of AltCLIP-m9 comes from the WuDao dataset and Liaon.
The AltCLIP-m9 model can support the AltDiffusion-m9 model in this project. For specific information about the AltDiffusion-m9 model, please refer to this tutorial.
Training
There are two phases of training.
In the parallel knowledge distillation phase, we only use parallel corpus texts for distillation (parallel corpus is easier to obtain and larger in number compared to image - text pairs). In the multilingual comparison learning phase, we use a small number of text - image pairs (about 6 million in each language) to train our text encoder to better fit the image encoder.
Performance

Visualization effects
Based on AltCLIP, we have also developed the AltDiffusion model, visualized as follows.

đģ Usage Examples
Basic Usage
Please download the code from FlagAI AltCLIP
from PIL import Image
import requests
from modeling_altclip import AltCLIP
from processing_altclip import AltCLIPProcessor
model = AltCLIP.from_pretrained("BAAI/AltCLIP-m9")
processor = AltCLIPProcessor.from_pretrained("BAAI/AltCLIP-m9")
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt", padding=True)
outputs = model(**inputs)
logits_per_image = outputs.logits_per_image
probs = logits_per_image.softmax(dim=1)
đ License
This model is under the CreativeML OpenRAIL - M license.
One more step before getting this model.
This model is open access and available to all, with a CreativeML OpenRAIL - M license further specifying rights and usage.
The CreativeML OpenRAIL License specifies:
- You can't use the model to deliberately produce nor share illegal or harmful outputs or content
- BAAI claims no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in the license
- You may re - distribute the weights and use the model commercially and/or as a service. If you do, please be aware you have to include the same use restrictions as the ones in the license and share a copy of the CreativeML OpenRAIL - M to all your users (please read the license entirely and carefully)
Please read the full license here: https://huggingface.co/spaces/CompVis/stable - diffusion - license
By clicking on "Access repository" below, you accept that your contact information (email address and username) can be shared with the model authors as well.
đ Citation
If you find this work helpful, please consider to cite
@article{https://doi.org/10.48550/arxiv.2211.06679,
doi = {10.48550/ARXIV.2211.06679},
url = {https://arxiv.org/abs/2211.06679},
author = {Chen, Zhongzhi and Liu, Guang and Zhang, Bo - Wen and Ye, Fulong and Yang, Qinghong and Wu, Ledell},
keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences},
title = {AltCLIP: Altering the Language Encoder in CLIP for Extended Language Capabilities},
publisher = {arXiv},
year = {2022},
copyright = {arXiv.org perpetual, non - exclusive license}
}