このリポジトリは、視覚学習とマルチモーダル学習の境界を押し広げる自己回帰モデルのファミリであるすべての目的のエントリポイントです。
Multimodal Autoregressive Pre-training of Large Vision Encoders [ BibTeX ]Scalable Pre-training of Large Autoregressive Image Models [ BibTeX ]*:平等な技術貢献
元のAIMモデル(AIMV1)を探している場合は、こちらを参照してください。
Multimodal Autore-Gisionsishing目的で事前に訓練された視力モデルのAIMV2ファミリーを紹介します。 AIMV2プリトレーニングは、トレーニングと効果的なスケーリングが簡単で簡単です。一部のAIMV2ハイライトには次のものが含まれます。
私たちは、さまざまな能力、トレーニング前解像度の事前訓練を受けたチェックポイントをAIMV2と共有します。
AIMv2 with 224px ]AIMv2 with 336px ]AIMv2 with 448px ]AIMv2 with Native Resolution ]AIMv2 distilled ViT-Large ](マルチモーダルアプリケーションに推奨)Zero-shot Adapted AIMv2 ] 公式のインストール手順を使用してPytorchをインストールしてください。その後、パッケージを次のようにインストールします。
pip install 'git+https://github.com/apple/ml-aim.git#subdirectory=aim-v1'
pip install 'git+https://github.com/apple/ml-aim.git#subdirectory=aim-v2'
また、Apple Siliconでの研究と実験のためのMLXバックエンドサポートも提供しています。 MLXサポートを有効にするには、単純に実行します。
pip install mlx
from PIL import Image
from aim . v2 . utils import load_pretrained
from aim . v1 . torch . data import val_transforms
img = Image . open (...)
model = load_pretrained ( "aimv2-large-patch14-336" , backend = "torch" )
transform = val_transforms ( img_size = 336 )
inp = transform ( img ). unsqueeze ( 0 )
features = model ( inp ) from PIL import Image
import mlx . core as mx
from aim . v2 . utils import load_pretrained
from aim . v1 . torch . data import val_transforms
img = Image . open (...)
model = load_pretrained ( "aimv2-large-patch14-336" , backend = "mlx" )
transform = val_transforms ( img_size = 336 )
inp = transform ( img ). unsqueeze ( 0 )
inp = mx . array ( inp . numpy ())
features = model ( inp ) from PIL import Image
import jax . numpy as jnp
from aim . v2 . utils import load_pretrained
from aim . v1 . torch . data import val_transforms
img = Image . open (...)
model , params = load_pretrained ( "aimv2-large-patch14-336" , backend = "jax" )
transform = val_transforms ( img_size = 336 )
inp = transform ( img ). unsqueeze ( 0 )
inp = jnp . array ( inp )
features = model . apply ({ "params" : params }, inp )事前に訓練されたモデルには、Huggingface Hubを介して以下にアクセスできます。
from PIL import Image
from transformers import AutoImageProcessor , AutoModel
image = Image . open (...)
processor = AutoImageProcessor . from_pretrained ( "apple/aimv2-large-patch14-336" )
model = AutoModel . from_pretrained ( "apple/aimv2-large-patch14-336" , trust_remote_code = True )
inputs = processor ( images = image , return_tensors = "pt" )
outputs = model ( ** inputs )| model_id | #params | IN-1K | HFリンク | バックボーン |
|---|---|---|---|---|
| AIMV2-Large-Patch14-224 | 0.3b | 86.6 | ?リンク | リンク |
| aimv2-huge-patch14-224 | 0.6b | 87.5 | ?リンク | リンク |
| AIMV2-1B-PATCH14-224 | 1.2b | 88.1 | ?リンク | リンク |
| AIMV2-3B-PATCH14-224 | 2.7b | 88.5 | ?リンク | リンク |
| model_id | #params | IN-1K | HFリンク | バックボーン |
|---|---|---|---|---|
| AIMV2-Large-Patch14-336 | 0.3b | 87.6 | ?リンク | リンク |
| aimv2-huge-patch14-336 | 0.6b | 88.2 | ?リンク | リンク |
| aimv2-1b-patch14-336 | 1.2b | 88.7 | ?リンク | リンク |
| aimv2-3b-patch14-336 | 2.7b | 89.2 | ?リンク | リンク |
| model_id | #params | IN-1K | HFリンク | バックボーン |
|---|---|---|---|---|
| AIMV2-Large-Patch14-448 | 0.3b | 87.9 | ?リンク | リンク |
| aimv2-huge-patch14-448 | 0.6b | 88.6 | ?リンク | リンク |
| aimv2-1b-patch14-448 | 1.2b | 89.0 | ?リンク | リンク |
| aimv2-3b-patch14-448 | 2.7b | 89.5 | ?リンク | リンク |
さらに、幅広い画像解像度とアスペクト比を処理するために微調整されたAIMV2-Lチェックポイントを提供します。アスペクト比に関係なく、画像はパッチ化され(patch_size = 14)、 2D正弦波位置埋め込みが線形投影された入力パッチに追加されます。このチェックポイントは、[112、4096]の範囲内のパッチの数をサポートします。
| model_id | #params | IN-1K | HFリンク | バックボーン |
|---|---|---|---|---|
| aimv2-large-patch14-native | 0.3b | 87.3 | ?リンク | リンク |
AIMV2-3Bから蒸留されたAIMV2-Lチェックポイントを提供し、マルチモーダル理解ベンチマークに顕著なパフォーマンスを提供します。
| モデル | VQAV2 | GQA | okvqa | textVqa | docvqa | infovqa | Chartqa | Sciqa | mmep |
|---|---|---|---|---|---|---|---|---|---|
| aimv2-l | 80.2 | 72.6 | 60.9 | 53.9 | 26.8 | 22.4 | 20.3 | 74.5 | 1457 |
| aimv2-l-distill | 81.1 | 73.0 | 61.4 | 53.5 | 29.2 | 23.3 | 24.0 | 76.3 | 1627 |
| model_id | #params | res。 | HFリンク | バックボーン |
|---|---|---|---|---|
| aimv2-large-patch14-224-distill | 0.3b | 224px | ?リンク | リンク |
| aimv2-large-patch14-336-distill | 0.3b | 336px | ?リンク | リンク |
照明されたチューニング後にAIMV2-Lのビジョンとテキストエンコーダーを提供して、ゼロショット認識を可能にします。
| モデル | #params | ゼロショットin1-k | バックボーン |
|---|---|---|---|
| aimv2-l | 0.3b | 77.0 | リンク |
私たちの作品が役立つと思う場合は、私たちを引用することを検討してください。
@misc { fini2024multimodal ,
title = { Multimodal Autoregressive Pre-training of Large Vision Encoders } ,
author = { Enrico Fini and Mustafa Shukor and Xiujun Li and Philipp Dufter and Michal Klein and David Haldimann and Sai Aitharaju and Victor Guilherme Turrisi da Costa and Louis Béthune and Zhe Gan and Alexander T Toshev and Marcin Eichner and Moin Nabi and Yinfei Yang and Joshua M. Susskind and Alaaeldin El-Nouby } ,
year = { 2024 } ,
eprint = { 2411.14402 } ,
archivePrefix = { arXiv } ,
primaryClass = { cs.CV }
} @InProceedings { pmlr-v235-el-nouby24a ,
title = { Scalable Pre-training of Large Autoregressive Image Models } ,
author = { El-Nouby, Alaaeldin and Klein, Michal and Zhai, Shuangfei and Bautista, Miguel '{A}ngel and Shankar, Vaishaal and Toshev, Alexander T and Susskind, Joshua M. and Joulin, Armand } ,
booktitle = { Proceedings of the 41st International Conference on Machine Learning } ,
pages = { 12371--12384 } ,
year = { 2024 } ,
}提供されたコードとモデルを使用する前に、リポジトリライセンスをチェックしてください。