yaswanthgali commited on
Commit
d20f0c6
·
verified ·
1 Parent(s): 0f3f395

Upload 11 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ aimv2_overview_light.png filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Disclaimer: IMPORTANT: This Apple Machine Learning Research Model is
2
+ specifically developed and released by Apple Inc. ("Apple") for the sole purpose
3
+ of scientific research of artificial intelligence and machine-learning
4
+ technology. “Apple Machine Learning Research Model” means the model, including
5
+ but not limited to algorithms, formulas, trained model weights, parameters,
6
+ configurations, checkpoints, and any related materials (including
7
+ documentation).
8
+
9
+ This Apple Machine Learning Research Model is provided to You by
10
+ Apple in consideration of your agreement to the following terms, and your use,
11
+ modification, creation of Model Derivatives, and or redistribution of the Apple
12
+ Machine Learning Research Model constitutes acceptance of this Agreement. If You
13
+ do not agree with these terms, please do not use, modify, create Model
14
+ Derivatives of, or distribute this Apple Machine Learning Research Model or
15
+ Model Derivatives.
16
+
17
+ * License Scope: In consideration of your agreement to abide by the following
18
+ terms, and subject to these terms, Apple hereby grants you a personal,
19
+ non-exclusive, worldwide, non-transferable, royalty-free, revocable, and
20
+ limited license, to use, copy, modify, distribute, and create Model
21
+ Derivatives (defined below) of the Apple Machine Learning Research Model
22
+ exclusively for Research Purposes. You agree that any Model Derivatives You
23
+ may create or that may be created for You will be limited to Research Purposes
24
+ as well. “Research Purposes” means non-commercial scientific research and
25
+ academic development activities, such as experimentation, analysis, testing
26
+ conducted by You with the sole intent to advance scientific knowledge and
27
+ research. “Research Purposes” does not include any commercial exploitation,
28
+ product development or use in any commercial product or service.
29
+
30
+ * Distribution of Apple Machine Learning Research Model and Model Derivatives:
31
+ If you choose to redistribute Apple Machine Learning Research Model or its
32
+ Model Derivatives, you must provide a copy of this Agreement to such third
33
+ party, and ensure that the following attribution notice be provided: “Apple
34
+ Machine Learning Research Model is licensed under the Apple Machine Learning
35
+ Research Model License Agreement.” Additionally, all Model Derivatives must
36
+ clearly be identified as such, including disclosure of modifications and
37
+ changes made to the Apple Machine Learning Research Model. The name,
38
+ trademarks, service marks or logos of Apple may not be used to endorse or
39
+ promote Model Derivatives or the relationship between You and Apple. “Model
40
+ Derivatives” means any models or any other artifacts created by modifications,
41
+ improvements, adaptations, alterations to the architecture, algorithm or
42
+ training processes of the Apple Machine Learning Research Model, or by any
43
+ retraining, fine-tuning of the Apple Machine Learning Research Model.
44
+
45
+ * No Other License: Except as expressly stated in this notice, no other rights
46
+ or licenses, express or implied, are granted by Apple herein, including but
47
+ not limited to any patent, trademark, and similar intellectual property rights
48
+ worldwide that may be infringed by the Apple Machine Learning Research Model,
49
+ the Model Derivatives or by other works in which the Apple Machine Learning
50
+ Research Model may be incorporated.
51
+
52
+ * Compliance with Laws: Your use of Apple Machine Learning Research Model must
53
+ be in compliance with all applicable laws and regulations.
54
+
55
+ * Term and Termination: The term of this Agreement will begin upon your
56
+ acceptance of this Agreement or use of the Apple Machine Learning Research
57
+ Model and will continue until terminated in accordance with the following
58
+ terms. Apple may terminate this Agreement at any time if You are in breach of
59
+ any term or condition of this Agreement. Upon termination of this Agreement,
60
+ You must cease to use all Apple Machine Learning Research Models and Model
61
+ Derivatives and permanently delete any copy thereof. Sections 3, 6 and 7 will
62
+ survive termination.
63
+
64
+ * Disclaimer and Limitation of Liability: This Apple Machine Learning Research
65
+ Model and any outputs generated by the Apple Machine Learning Research Model
66
+ are provided on an “AS IS” basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
67
+ IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF
68
+ NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE,
69
+ REGARDING THE APPLE MACHINE LEARNING RESEARCH MODEL OR OUTPUTS GENERATED BY
70
+ THE APPLE MACHINE LEARNING RESEARCH MODEL. You are solely responsible for
71
+ determining the appropriateness of using or redistributing the Apple Machine
72
+ Learning Research Model and any outputs of the Apple Machine Learning Research
73
+ Model and assume any risks associated with Your use of the Apple Machine
74
+ Learning Research Model and any output and results. IN NO EVENT SHALL APPLE BE
75
+ LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
76
+ IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF
77
+ THE APPLE MACHINE LEARNING RESEARCH MODEL AND ANY OUTPUTS OF THE APPLE MACHINE
78
+ LEARNING RESEARCH MODEL, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
79
+ TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS
80
+ BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
81
+
82
+ * Governing Law: This Agreement will be governed by and construed under the laws
83
+ of the State of California without regard to its choice of law principles. The
84
+ Convention on Contracts for the International Sale of Goods shall not apply to
85
+ the Agreement except that the arbitration clause and any arbitration hereunder
86
+ shall be governed by the Federal Arbitration Act, Chapters 1 and 2. 
87
+
88
+ Copyright (C) 2025 Apple Inc. All Rights Reserved.
README.md CHANGED
@@ -1,3 +1,82 @@
1
- ---
2
- license: apple-amlr
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: apple-amlr
4
+ metrics:
5
+ - accuracy
6
+ pipeline_tag: image-feature-extraction
7
+ tags:
8
+ - vision
9
+ - image-feature-extraction
10
+ - mlx
11
+ - pytorch
12
+ ---
13
+ # Introduction
14
+ [[`AIMv2 Paper`](https://arxiv.org/abs/2411.14402)] [[`BibTeX`](#citation)]
15
+
16
+ We introduce the AIMv2 family of vision models pre-trained with a multimodal autoregressive objective.
17
+ AIMv2 pre-training is simple and straightforward to train and scale effectively. Some AIMv2 highlights include:
18
+
19
+ 1. Outperforms OAI CLIP and SigLIP on the majority of multimodal understanding benchmarks.
20
+ 2. Outperforms DINOv2 on open-vocabulary object detection and referring expression comprehension.
21
+ 3. Exhibits strong recognition performance with AIMv2-3B achieving *89.5% on ImageNet using a frozen trunk*.
22
+
23
+ <img src="aimv2_overview_light.png" alt="AIMv2 Overview"/>
24
+
25
+ ## Usage
26
+
27
+ ### PyTorch
28
+ ```python
29
+ import requests
30
+ from PIL import Image
31
+ from transformers import AutoImageProcessor, AutoModel
32
+
33
+ url = "http://images.cocodataset.org/val2017/000000039769.jpg"
34
+ image = Image.open(requests.get(url, stream=True).raw)
35
+
36
+ processor = AutoImageProcessor.from_pretrained(
37
+ "apple/aimv2-large-patch14-native",
38
+ )
39
+ model = AutoModel.from_pretrained(
40
+ "apple/aimv2-large-patch14-native",
41
+ trust_remote_code=True,
42
+ )
43
+
44
+ inputs = processor(images=image, return_tensors="pt")
45
+ outputs = model(**inputs)
46
+ ```
47
+
48
+ ### JAX
49
+ ```python
50
+ import requests
51
+ from PIL import Image
52
+ from transformers import AutoImageProcessor, FlaxAutoModel
53
+
54
+ url = "http://images.cocodataset.org/val2017/000000039769.jpg"
55
+ image = Image.open(requests.get(url, stream=True).raw)
56
+
57
+ processor = AutoImageProcessor.from_pretrained(
58
+ "apple/aimv2-large-patch14-native",
59
+ )
60
+ model = FlaxAutoModel.from_pretrained(
61
+ "apple/aimv2-large-patch14-native",
62
+ trust_remote_code=True,
63
+ )
64
+
65
+ inputs = processor(images=image, return_tensors="jax")
66
+ outputs = model(**inputs)
67
+ ```
68
+
69
+ ## Citation
70
+ If you find our work useful, please consider citing us as:
71
+ ```bibtex
72
+ @misc{fini2024multimodalautoregressivepretraininglarge,
73
+ 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},
74
+ url = {https://arxiv.org/abs/2411.14402},
75
+ eprint = {2411.14402},
76
+ eprintclass = {cs.CV},
77
+ eprinttype = {arXiv},
78
+ title = {Multimodal Autoregressive Pre-training of Large Vision Encoders},
79
+ year = {2024},
80
+ }
81
+ ```
82
+
aimv2_overview_light.png ADDED

Git LFS Details

  • SHA256: 524b6eb5049fb4bac6303ecee386d0e885fa69a96756557d843084ba4caae08f
  • Pointer size: 131 Bytes
  • Size of remote file: 336 kB
config.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "AIMv2Model"
4
+ ],
5
+ "auto_map": {
6
+ "AutoConfig": "apple/aimv2-large-patch14-224-lit--configuration_aimv2.AIMv2Config",
7
+ "AutoModel": "apple/aimv2-large-patch14-224-lit--modeling_aimv2.AIMv2Model"
8
+ },
9
+ "init_temperature": 0.07,
10
+ "logit_scale_init_value": 2.6592,
11
+ "max_logit_scale": 100.0,
12
+ "model_type": "aimv2",
13
+ "projection_dim": 768,
14
+ "text_config": {
15
+ "_attn_implementation_autoset": true,
16
+ "attention_dropout": 0.0,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 768,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 2048,
21
+ "is_causal": true,
22
+ "max_context_length": 77,
23
+ "max_position_embeddings": 77,
24
+ "model_type": "aimv2_text_model",
25
+ "num_attention_heads": 6,
26
+ "num_hidden_layers": 12,
27
+ "projection_dropout": 0.0,
28
+ "qkv_bias": false,
29
+ "rms_norm_eps": 1e-05,
30
+ "use_bias": false,
31
+ "vocab_size": 49408
32
+ },
33
+ "torch_dtype": "float32",
34
+ "transformers_version": "4.51.0.dev0",
35
+ "vision_config": {
36
+ "_attn_implementation_autoset": true,
37
+ "attention_dropout": 0.0,
38
+ "hidden_act": "silu",
39
+ "hidden_size": 1024,
40
+ "image_size": 224,
41
+ "initializer_range": 0.02,
42
+ "intermediate_size": 2816,
43
+ "is_causal": false,
44
+ "model_type": "aimv2_vision_model",
45
+ "num_attention_heads": 8,
46
+ "num_channels": 3,
47
+ "num_hidden_layers": 24,
48
+ "num_queries": 1,
49
+ "patch_size": 14,
50
+ "projection_dropout": 0.0,
51
+ "qkv_bias": false,
52
+ "rms_norm_eps": 1e-05,
53
+ "use_bias": false,
54
+ "use_head": true
55
+ }
56
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:055655dcf78e1ef05e5f065747691eabdd8c3de416c79f1592f0f3ff8ab7bc9f
3
+ size 1746762564
preprocessor_config.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": {
3
+ "height": 224,
4
+ "width": 224
5
+ },
6
+ "data_format": "channels_first",
7
+ "default_to_square": false,
8
+ "device": null,
9
+ "do_center_crop": true,
10
+ "do_convert_rgb": true,
11
+ "do_normalize": true,
12
+ "do_rescale": true,
13
+ "do_resize": true,
14
+ "image_mean": [
15
+ 0.48145466,
16
+ 0.4578275,
17
+ 0.40821073
18
+ ],
19
+ "image_processor_type": "CLIPImageProcessorFast",
20
+ "image_std": [
21
+ 0.26862954,
22
+ 0.26130258,
23
+ 0.27577711
24
+ ],
25
+ "input_data_format": null,
26
+ "processor_class": "CLIPProcessor",
27
+ "resample": 3,
28
+ "rescale_factor": 0.00392156862745098,
29
+ "return_tensors": null,
30
+ "size": {
31
+ "shortest_edge": 224
32
+ }
33
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<start_of_text>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<end_of_text>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<end_of_text>",
18
+ "lstrip": false,
19
+ "normalized": true,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<end_of_text>",
25
+ "lstrip": false,
26
+ "normalized": true,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "49406": {
4
+ "content": "<start_of_text>",
5
+ "lstrip": false,
6
+ "normalized": true,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "49407": {
12
+ "content": "<end_of_text>",
13
+ "lstrip": false,
14
+ "normalized": true,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ }
19
+ },
20
+ "bos_token": "<start_of_text>",
21
+ "clean_up_tokenization_spaces": false,
22
+ "eos_token": "<end_of_text>",
23
+ "errors": "replace",
24
+ "extra_special_tokens": {},
25
+ "model_max_length": 77,
26
+ "pad_token": "<end_of_text>",
27
+ "processor_class": "CLIPProcessor",
28
+ "tokenizer_class": "CLIPTokenizer",
29
+ "unk_token": "<end_of_text>",
30
+ "use_fast": true
31
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff