ホーム>プログラミング関連>パイソン

私たちは、さまざまな能力、トレーニング前解像度の事前訓練を受けたチェックポイントを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

Pytorchを使用します

 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 )

MLXを使用します

 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 )

JAXを使用します

 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 )

224pxのAIMV2

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 ?リンクリンク

336pxのaimv2

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 ?リンクリンク

448pxのaimv2

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

さらに、幅広い画像解像度とアスペクト比を処理するために微調整されたAIMV2-Lチェックポイントを提供します。アスペクト比に関係なく、画像はパッチ化され(patch_size = 14)、 2D正弦波位置埋め込みが線形投影された入力パッチに追加されます。このチェックポイントは、[112、4096]の範囲内のパッチの数をサポートします

model_id #params IN-1K HFリンクバックボーン
aimv2-large-patch14-native 0.3b 87.3 ?リンクリンク

AIMV2蒸留vit-large

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

照明されたチューニング後にAIMV2-Lのビジョンとテキストエンコーダーを提供して、ゼロショット認識を可能にします。

モデル#paramsゼロショットin1-kバックボーン
aimv2-l 0.3b 77.0リンク

引用

私たちの作品が役立つと思う場合は、私たちを引用することを検討してください。

aimv2 bibtex

 @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 }
}

aimv1 bibtex

 @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 } ,
}

ライセンス

提供されたコードとモデルを使用する前に、リポジトリライセンスをチェックしてください。

拡大する
追加情報