🚀 llm-jp-clip-vit-large-patch14
このモデルは、日本語の画像とテキストを関連付けるためのCLIPモデルです。OpenCLIPを用いて訓練され、大規模な日本語の画像-テキストペアデータセットを利用しています。
🚀 クイックスタート
このモデルは、日本語の画像とテキストを関連付けるためのCLIPモデルです。OpenCLIPを用いて訓練され、大規模な日本語の画像-テキストペアデータセットを利用しています。以下に、使用方法を説明します。
✨ 主な機能
- 日本語の画像とテキストを関連付けることができます。
- ゼロショット画像分類や画像-テキスト検索などのタスクに利用できます。
📦 インストール
このモデルを使用するには、open_clip_torch
をインストールする必要があります。以下のコマンドを実行してください。
$ pip install open_clip_torch
💻 使用例
基本的な使用法
import open_clip
model, preprocess = open_clip.create_model_from_pretrained('hf-hub:llm-jp/llm-jp-clip-vit-large-patch14')
tokenizer = open_clip.get_tokenizer('hf-hub:llm-jp/llm-jp-clip-vit-large-patch14')
import torch
from PIL import Image
import requests
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
image = Image.open(requests.get(url, stream=True).raw)
image = preprocess(image).unsqueeze(0)
text = tokenizer(["猫", "犬", "鳥"])
with torch.no_grad(), torch.cuda.amp.autocast():
image_features = model.encode_image(image)
text_features = model.encode_text(text)
image_features /= image_features.norm(dim=-1, keepdim=True)
text_features /= text_features.norm(dim=-1, keepdim=True)
text_probs = (100.0 * image_features @ text_features.T).softmax(dim=-1)
print("Label probs:", text_probs)
📚 ドキュメント
モデルの詳細
このモデルは、OpenCLIPを用いて、relaion2B-en-research-safe-japanese-translationというデータセットで訓練された日本語CLIPモデルです。このデータセットは、ReLAION-5Bの英語サブセットの日本語訳で、gemma-2-9b-itによって翻訳されています。
このモデルの総パラメータ数は467Mです。
訓練の詳細
モデルアーキテクチャ
訓練データ
このモデルは、relaion2B-en-research-safe-japanese-translationというデータセットで訓練されています。画像ダウンロードの成功率が70%であったため、データセットのサイズは14.5億サンプルとなり、9エポック(合計130億サンプル)で処理されました。
評価
評価コードは、こちらにあります。
以下の表は、各モデルのゼロショット画像分類と画像-テキスト検索タスクにおける性能を示しています。太字は1位、_下線_は2位を示しています。
📄 ライセンス
このモデルは、The Apache License, Version 2.0の下で提供されています。
訓練データはgemma-2-9b-itを用いて翻訳されているため、Gemma Terms of Useを参照してください。私たちはGemmaを翻訳目的のみに利用しています。セクション1.1(e)の「Model Derivatives」の定義によれば、私たちのモデルは「Gemmaと同様の動作をさせるためのモデル」には該当しません。したがって、Gemmaのライセンスを引き継ぐ必要はないと結論付けています。
引用
@inproceedings{sugiura-etal-2025-developing,
title = "Developing {J}apanese {CLIP} Models Leveraging an Open-weight {LLM} for Large-scale Dataset Translation",
author = "Sugiura, Issa and
Kurita, Shuhei and
Oda, Yusuke and
Kawahara, Daisuke and
Okazaki, Naoaki",
editor = "Ebrahimi, Abteen and
Haider, Samar and
Liu, Emmy and
Haider, Sammar and
Leonor Pacheco, Maria and
Wein, Shira",
booktitle = "Proceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 4: Student Research Workshop)",
month = apr,
year = "2025",
address = "Albuquerque, USA",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2025.naacl-srw.15/",
pages = "162--170",
ISBN = "979-8-89176-192-6",
abstract = "CLIP is a foundational model that bridges images and text, widely adopted as a key component in numerous vision-language models.However, the lack of large-scale open Japanese image-text pairs poses a significant barrier to the development of Japanese vision-language models.In this study, we constructed a Japanese image-text pair dataset with 1.5 billion examples using machine translation with open-weight LLMs and pre-trained Japanese CLIP models on the dataset.The performance of the pre-trained models was evaluated across seven benchmark datasets, achieving competitive average scores compared to models of similar size without the need for extensive data curation. However, the results also revealed relatively low performance on tasks specific to Japanese culture, highlighting the limitations of translation-based approaches in capturing cultural nuances. Our dataset, models, and code are publicly available."
}