🚀 ViT-H-14-CLIPA-336-datacomp1Bのモデルカード
CLIPA-v2モデルは、特定のタスクにおいて高い性能を発揮する画像とテキストのコントラスト学習モデルです。ゼロショット画像分類などのタスクに適しています。
🚀 クイックスタート
このモデルは、CLIPA-v2アーキテクチャを使用したコントラスト画像 - テキストモデルで、ゼロショット画像分類に使用できます。
✨ 主な機能
- コントラスト画像 - テキストモデルとして、画像とテキストの関連性を学習します。
- ゼロショット画像分類タスクに対応しています。
📦 インストール
このモデルを使用するには、open_clip
ライブラリが必要です。以下のコードを参考にしてください。
💻 使用例
基本的な使用法
import torch
import torch.nn.functional as F
from urllib.request import urlopen
from PIL import Image
from open_clip import create_model_from_pretrained, get_tokenizer
model, preprocess = create_model_from_pretrained('hf-hub:ViT-H-14-CLIPA-336')
tokenizer = get_tokenizer('hf-hub:ViT-H-14-CLIPA-336')
image = Image.open(urlopen(
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))
image = preprocess(image).unsqueeze(0)
text = tokenizer(["a diagram", "a dog", "a cat", "a beignet"], context_length=model.context_length)
with torch.no_grad(), torch.cuda.amp.autocast():
image_features = model.encode_image(image)
text_features = model.encode_text(text)
image_features = F.normalize(image_features, dim=-1)
text_features = F.normalize(text_features, dim=-1)
text_probs = (100.0 * image_features @ text_features.T).softmax(dim=-1)
print("Label probs:", text_probs)
📚 ドキュメント
モデル詳細
属性 |
详情 |
モデルタイプ |
コントラスト画像 - テキスト、ゼロショット画像分類 |
オリジナル |
https://github.com/UCSC-VLAA/CLIPA |
データセット |
mlfoundations/datacomp_1b |
論文 |
- CLIPA-v2: Scaling CLIP Training with 81.1% Zero-shot ImageNet Accuracy within a $10,000 Budget; An Extra $4,000 Unlocks 81.8% Accuracy: https://arxiv.org/abs/2306.15658 - An Inverse Scaling Law for CLIP Training: https://arxiv.org/abs/2305.07017 |
📄 ライセンス
このモデルは、Apache-2.0ライセンスの下で公開されています。
引用
@article{li2023clipav2,
title={CLIPA-v2: Scaling CLIP Training with 81.1% Zero-shot ImageNet Accuracy within a $10,000 Budget; An Extra $4,000 Unlocks 81.8% Accuracy},
author={Xianhang Li and Zeyu Wang and Cihang Xie},
journal={arXiv preprint arXiv:2306.15658},
year={2023},
}
@inproceedings{li2023clipa,
title={An Inverse Scaling Law for CLIP Training},
author={Xianhang Li and Zeyu Wang and Cihang Xie},
booktitle={NeurIPS},
year={2023},
}