🚀 llm - jp - clip - vit - base - patch16
このモデルは、OpenCLIPを使用して学習された日本語CLIPモデルで、大規模な日本語画像 - テキストペアデータセットを活用しています。画像とテキストの関連付けに優れ、ゼロショット画像分類などのタスクに有効です。
🚀 クイックスタート
このモデルは、日本語の画像とテキストの関連付けに特化したCLIPモデルです。以下のセクションでは、モデルのインストール方法と使用例を紹介します。
📦 インストール
$ pip install open_clip_torch
💻 使用例
基本的な使用法
import open_clip
model, preprocess = open_clip.create_model_from_pretrained('hf-hub:llm-jp/llm-jp-clip-vit-base-patch16')
tokenizer = open_clip.get_tokenizer('hf-hub:llm-jp/llm-jp-clip-vit-base-patch16')
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)
参考情報
📚 ドキュメント
モデルの詳細
この日本語CLIPモデルは、OpenCLIPを用いて、relaion2B - en - research - safe - japanese - translationで学習されています。このデータセットは、ReLAION - 5Bの英語サブセットの日本語訳で、gemma - 2 - 9b - itによって翻訳されています。
このモデルの総パラメータ数は248Mです。
学習の詳細
モデルアーキテクチャ
- テキストエンコーダ: llm - jp - tokenizerを備えたRoBERTa base
- 画像エンコーダ: ViT - B/16
学習データ
このモデルは、relaion2B - en - research - safe - japanese - translationで学習されています。画像ダウンロードの成功率が70%であったため、データセットサイズは14.5億サンプルで、9エポック(合計130億サンプル)にわたって処理されました。
評価
評価コード: https://github.com/llm-jp/clip-eval
表: 各モデルのゼロショット画像分類と画像 - テキスト検索タスクにおける性能。太字は1位を、_下線_は2位を示します。
📄 ライセンス
The Apache License, Version 2.0
学習データはgemma - 2 - 9b - itを使用して翻訳されているため、Gemma Terms of Useを参照してください。当社はGemmaを翻訳目的のみに利用しています。セクション1.1(e)の「モデル派生品」の定義によれば、当社のモデルは「Gemmaと同様の動作をさせるためのモデル」には該当しません。したがって、Gemmaのライセンスを引き継ぐ必要はないと結論付けています。
引用
Bibtex:
@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."
}