AIMv2
Collection
A collection of AIMv2 vision encoders that supports a number of resolutions, native resolution, and a distilled checkpoint. • 16 items • Updated • 84
Run apple/aimv2-1B-patch14-448 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/apple/aimv2-1B-patch14-448. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/apple/aimv2-1B-patch14-448 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
How to use apple/aimv2-1B-patch14-448 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-feature-extraction", model="apple/aimv2-1B-patch14-448", trust_remote_code=True) # pip install -U transformers accelerate
# Load model directly
from transformers import AutoImageProcessor, AutoModel
processor = AutoImageProcessor.from_pretrained("apple/aimv2-1B-patch14-448", trust_remote_code=True)
model = AutoModel.from_pretrained("apple/aimv2-1B-patch14-448", trust_remote_code=True, device_map="auto")How to use apple/aimv2-1B-patch14-448 with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download apple/aimv2-1B-patch14-448 --local-dir aimv2-1B-patch14-448
[AIMv2 Paper] [BibTeX]
We introduce the AIMv2 family of vision models pre-trained with a multimodal autoregressive objective. AIMv2 pre-training is simple and straightforward to train and scale effectively. Some AIMv2 highlights include:
import requests
from PIL import Image
from transformers import AutoImageProcessor, AutoModel
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
processor = AutoImageProcessor.from_pretrained(
"apple/aimv2-1B-patch14-448",
revision="7f292735d3a07a911559c0fabb3ad3e9d141713f",
)
model = AutoModel.from_pretrained(
"apple/aimv2-1B-patch14-448",
revision="7f292735d3a07a911559c0fabb3ad3e9d141713f",
trust_remote_code=True,
)
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
import requests
from PIL import Image
from transformers import AutoImageProcessor, FlaxAutoModel
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
processor = AutoImageProcessor.from_pretrained(
"apple/aimv2-1B-patch14-448",
)
model = FlaxAutoModel.from_pretrained(
"apple/aimv2-1B-patch14-448",
trust_remote_code=True,
)
inputs = processor(images=image, return_tensors="jax")
outputs = model(**inputs)
If you find our work useful, please consider citing us as:
@misc{fini2024multimodalautoregressivepretraininglarge,
author = {Fini, Enrico and Shukor, Mustafa and Li, Xiujun and Dufter, Philipp and Klein, Michal and Haldimann, David and Aitharaju, Sai and da Costa, Victor Guilherme Turrisi and Béthune, Louis and Gan, Zhe and Toshev, Alexander T and Eichner, Marcin and Nabi, Moin and Yang, Yinfei and Susskind, Joshua M. and El-Nouby, Alaaeldin},
url = {https://arxiv.org/abs/2411.14402},
eprint = {2411.14402},
eprintclass = {cs.CV},
eprinttype = {arXiv},
title = {Multimodal Autoregressive Pre-training of Large Vision Encoders},
year = {2024},
}
Quantized