tarekziade HF Staff commited on
Commit
770cc8e
·
verified ·
1 Parent(s): 09c8e9e

Publish MIC usage, slim fixture and reviewed Transformers expectations

Browse files
.mic-repo.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "mic-umbrella-v1",
3
+ "contract_files": [
4
+ "integration.json",
5
+ "integrations/transformers/usage.md"
6
+ ]
7
+ }
README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - mic
4
+ - test-artifact
5
+ base_model: facebook/dinov2-small
6
+ ---
7
+
8
+ # dinov2-small-mic
9
+
10
+ Slim model weights, executable usage and framework expectations in one repository.
11
+
12
+ - [Contract manifest](integration.json)
13
+ - [Transformers usage](integrations/transformers/usage.md)
14
+ - [Transformers expectations](integrations/transformers/expectations)
15
+ - [Fixture provenance](build.json)
16
+
17
+ ## Contract
18
+
19
+ ### DINOv2 image features
20
+
21
+ Runnable usage and the framework expectations directory are linked above.
22
+
23
+ ## Slim model
24
+
25
+ ### Slim fixture: dinov2-small-mic
26
+
27
+ A 0.2M-parameter fixture for the [DINOv2 MIC](https://huggingface.co/huggingface-mic/dinov2-small-mic), covering [`facebook/dinov2-small`](https://huggingface.co/facebook/dinov2-small). It is a test artifact, not a usable model, tagged `test-artifact` to keep it out of candidate-model search.
28
+
29
+ - **Fixture key `c18a1be82d3e`.** It covers every checkpoint whose processor files are byte-identical and whose config matches after shrinking.
30
+ - **Same architecture, smaller config:** `Dinov2Model`, shrunk by the generic rule in [`sweep.py`](https://github.com/huggingface/transformers-mic/blob/main/experiments/sweep.py) (num_hidden_layers 2).
31
+ - **Processor files copied byte for byte** from `facebook/dinov2-small`: `preprocessor_config.json`.
32
+ - **Random weights (seed 17).** They passed the input-sensitivity gate: every perturbation of the contract's inputs moved the logits by at least 0.001 (weakest: `pixel_values:halve`, 0.331), so no training was needed.
33
+ - **Same tensor names as the real checkpoint.** The real checkpoint has every parameter, and so does the fixture.
34
+ - **Saved in float32**, the dtype `facebook/dinov2-small` loads in by default.
35
+ - **Finite in float32, bfloat16, and float16** (forward, loss, gradients).
36
+
37
+ Built by [`build_fixtures.py`](https://github.com/huggingface/transformers-mic/blob/main/example/build_fixtures.py); [`build.json`](build.json) records the pinned sources, gate results, and file hashes. This repository includes the slim weights, usage and framework expectations; rebuild the other files with `python example/build_fixtures.py --fixture dinov2-small-mic`.
build.json ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fixture": "huggingface-mic/dinov2-small-mic",
3
+ "key": "c18a1be82d3e7a3a60b8a875a1608fe4f8e9a583b6f10c9620d046e7ee68ce64",
4
+ "key_fields": {
5
+ "architectures": [
6
+ "Dinov2Model"
7
+ ],
8
+ "output_hidden_states": false,
9
+ "return_dict": true,
10
+ "chunk_size_feed_forward": 0,
11
+ "is_encoder_decoder": false,
12
+ "id2label": {
13
+ "0": "LABEL_0",
14
+ "1": "LABEL_1"
15
+ },
16
+ "label2id": {
17
+ "LABEL_0": 0,
18
+ "LABEL_1": 1
19
+ },
20
+ "problem_type": null,
21
+ "hidden_size": 64,
22
+ "num_hidden_layers": 2,
23
+ "num_attention_heads": 4,
24
+ "mlp_ratio": 4,
25
+ "hidden_act": "gelu",
26
+ "hidden_dropout_prob": 0.0,
27
+ "attention_probs_dropout_prob": 0.0,
28
+ "initializer_range": 0.02,
29
+ "layer_norm_eps": 1e-06,
30
+ "image_size": 518,
31
+ "patch_size": 14,
32
+ "num_channels": 3,
33
+ "qkv_bias": true,
34
+ "layerscale_value": 1.0,
35
+ "drop_path_rate": 0.0,
36
+ "use_swiglu_ffn": false,
37
+ "apply_layernorm": true,
38
+ "reshape_hidden_states": true,
39
+ "use_mask_token": true,
40
+ "stage_names": [
41
+ "stem",
42
+ "stage1",
43
+ "stage2",
44
+ "stage3",
45
+ "stage4",
46
+ "stage5",
47
+ "stage6",
48
+ "stage7",
49
+ "stage8",
50
+ "stage9",
51
+ "stage10",
52
+ "stage11",
53
+ "stage12"
54
+ ],
55
+ "model_type": "dinov2",
56
+ "output_attentions": false,
57
+ "out_features": [
58
+ "stage2"
59
+ ],
60
+ "out_indices": [
61
+ 2
62
+ ]
63
+ },
64
+ "covers": {
65
+ "facebook/dinov2-small": "ed25f3a31f01632728cabb09d1542f84ab7b0056"
66
+ },
67
+ "built_from": {
68
+ "repo": "facebook/dinov2-small",
69
+ "revision": "ed25f3a31f01632728cabb09d1542f84ab7b0056"
70
+ },
71
+ "seed": 17,
72
+ "dtype": "float32",
73
+ "builder": "example/build_fixtures.py",
74
+ "model_class": "Dinov2Model",
75
+ "parameters": 225856,
76
+ "missing_parameters": [],
77
+ "checkpoint_inspection": "parameter headers/indexes; bounded binary fallback",
78
+ "numeric_health_scope": "CPU float32/bfloat16/float16; autocast for low-precision losses",
79
+ "captured": {
80
+ "call": "training step",
81
+ "inputs": [
82
+ "pixel_values"
83
+ ],
84
+ "class": "Dinov2Model"
85
+ },
86
+ "weights": "random",
87
+ "gate": {
88
+ "random": {
89
+ "pass": true,
90
+ "accepted_insensitive": {},
91
+ "threshold": 0.001,
92
+ "deltas": {
93
+ "pixel_values:roll_batch": 4.062774658203125,
94
+ "pixel_values:swap_channels": 4.1026763916015625,
95
+ "pixel_values:reverse": null,
96
+ "pixel_values:halve": 0.33074086904525757
97
+ },
98
+ "weakest": "pixel_values:halve",
99
+ "no_perturbation_defined": [],
100
+ "not_a_forward_parameter": []
101
+ }
102
+ },
103
+ "numeric_health": {
104
+ "float32": {
105
+ "outputs_finite": true,
106
+ "finite": true
107
+ },
108
+ "bfloat16": {
109
+ "outputs_finite": true,
110
+ "finite": true
111
+ },
112
+ "float16": {
113
+ "outputs_finite": true,
114
+ "finite": true
115
+ }
116
+ },
117
+ "copied_unchanged": [
118
+ "preprocessor_config.json"
119
+ ],
120
+ "environment": {
121
+ "python": "3.12.12",
122
+ "machine": "arm64",
123
+ "torch": "2.14.1",
124
+ "transformers": "5.22.0.dev0",
125
+ "tokenizers": "0.23.3"
126
+ },
127
+ "sha256": {
128
+ "config.json": "d4477978e933094096c9a6245903ab43754b1cb8ce7e6154557a62279b401d65",
129
+ "model.safetensors": "c3912762cb2c791b01d4b9b5b7cd51c5562cd6a1d3ad9448ff4c1a92efc753ed",
130
+ "preprocessor_config.json": "14e780d86fa1861f8751f868d7f45425b5feb55c38ca26f152ca5097ab30f828"
131
+ }
132
+ }
config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "apply_layernorm": true,
3
+ "architectures": [
4
+ "Dinov2Model"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "drop_path_rate": 0.0,
8
+ "dtype": "float32",
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.0,
11
+ "hidden_size": 64,
12
+ "image_size": 518,
13
+ "initializer_range": 0.02,
14
+ "layer_norm_eps": 1e-06,
15
+ "layerscale_value": 1.0,
16
+ "mlp_ratio": 4,
17
+ "model_type": "dinov2",
18
+ "num_attention_heads": 4,
19
+ "num_channels": 3,
20
+ "num_hidden_layers": 2,
21
+ "out_features": [
22
+ "stage2"
23
+ ],
24
+ "out_indices": [
25
+ 2
26
+ ],
27
+ "patch_size": 14,
28
+ "qkv_bias": true,
29
+ "reshape_hidden_states": true,
30
+ "stage_names": [
31
+ "stem",
32
+ "stage1",
33
+ "stage2",
34
+ "stage3",
35
+ "stage4",
36
+ "stage5",
37
+ "stage6",
38
+ "stage7",
39
+ "stage8",
40
+ "stage9",
41
+ "stage10",
42
+ "stage11",
43
+ "stage12"
44
+ ],
45
+ "transformers_version": "5.22.0.dev0",
46
+ "use_mask_token": true,
47
+ "use_swiglu_ffn": false
48
+ }
integration.json ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mic": "0.3",
3
+ "name": "DINOv2 image features",
4
+ "usage": "AutoImageProcessor + AutoModel, batched images, last_hidden_state probes, one SGD step on the CLS token",
5
+ "architecture": "Dinov2Model",
6
+ "checkpoints": {
7
+ "facebook/dinov2-small": {
8
+ "fixture": "huggingface-mic/dinov2-small-mic"
9
+ }
10
+ },
11
+ "fixtures": {
12
+ "huggingface-mic/dinov2-small-mic": {
13
+ "built_from": "facebook/dinov2-small",
14
+ "covers": [
15
+ "facebook/dinov2-small"
16
+ ],
17
+ "build": {
18
+ "seed": 17
19
+ }
20
+ }
21
+ },
22
+ "integrations": {
23
+ "transformers": {
24
+ "entry_point": "integrations/transformers/usage.md",
25
+ "format": "runnable-markdown",
26
+ "requires": [
27
+ "transformers>=5",
28
+ "torch",
29
+ "pillow"
30
+ ],
31
+ "targets": [
32
+ "fixtures",
33
+ "checkpoints"
34
+ ],
35
+ "variants": {
36
+ "default": {},
37
+ "eager": {
38
+ "attn_implementation": "eager"
39
+ },
40
+ "bfloat16": {
41
+ "dtype": "bfloat16"
42
+ }
43
+ },
44
+ "training": true,
45
+ "resources": {
46
+ "fixture": {
47
+ "memory_gb": 2,
48
+ "download_mb": 90
49
+ },
50
+ "facebook/dinov2-small": {
51
+ "memory_gb": 4,
52
+ "download_mb": 90
53
+ }
54
+ }
55
+ }
56
+ },
57
+ "outputs": {
58
+ "runtime": {
59
+ "compare": "exact"
60
+ },
61
+ "cls_features": {
62
+ "compare": "allclose",
63
+ "atol": 0.0001,
64
+ "rtol": 0.0001
65
+ },
66
+ "patch_features": {
67
+ "compare": "allclose",
68
+ "atol": 0.0001,
69
+ "rtol": 0.0001
70
+ },
71
+ "training.loss": {
72
+ "compare": "allclose",
73
+ "atol": 0.0001,
74
+ "rtol": 0.0001
75
+ },
76
+ "training.gradients": {
77
+ "compare": "all_true"
78
+ },
79
+ "training.updated": {
80
+ "compare": "true"
81
+ }
82
+ }
83
+ }
integrations/transformers/expectations/cpu-x86_64-bf16/dinov2-small-mic.bfloat16.json ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/dinov2-small-mic",
4
+ "contract_name": "DINOv2",
5
+ "contract_revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
6
+ "framework": "transformers",
7
+ "variant": "bfloat16",
8
+ "target": "dinov2-small-mic",
9
+ "kind": "fixture",
10
+ "revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
11
+ "environment": {
12
+ "python": "3.11.18",
13
+ "transformers": "5.22.0.dev0",
14
+ "torch": "2.14.0+cpu",
15
+ "torchvision": "0.29.2+cpu",
16
+ "torchaudio": "2.11.1+cpu",
17
+ "tokenizers": "0.23.3",
18
+ "numpy": "2.3.5",
19
+ "pillow": "13.0.0",
20
+ "accelerate": "1.15.0",
21
+ "safetensors": "0.8.0",
22
+ "huggingface-hub": "2.3.0",
23
+ "sentencepiece": "0.2.2",
24
+ "protobuf": "7.36.2",
25
+ "librosa": "0.11.0",
26
+ "soundfile": "0.14.0",
27
+ "scipy": "1.17.1"
28
+ },
29
+ "seconds": 7.36,
30
+ "environment_differs": {
31
+ "torchvision": "0.29.2+cpu (pinned 0.29.1)",
32
+ "torchaudio": "2.11.1+cpu (pinned 2.11.0)",
33
+ "pillow": "13.0.0 (pinned 12.3.0)"
34
+ },
35
+ "platform": "cpu-x86_64-bf16"
36
+ },
37
+ "outputs": {
38
+ "runtime": {
39
+ "device": "cpu",
40
+ "dtype": "bfloat16",
41
+ "attn_implementation": "sdpa"
42
+ },
43
+ "cls_features": [
44
+ [
45
+ -1.265625,
46
+ 0.451171875,
47
+ -0.9765625,
48
+ -1.6953125,
49
+ -0.11083984375
50
+ ],
51
+ [
52
+ -0.158203125,
53
+ 0.625,
54
+ -0.875,
55
+ -0.56640625,
56
+ -0.345703125
57
+ ]
58
+ ],
59
+ "patch_features": [
60
+ [
61
+ [
62
+ -0.458984375,
63
+ 0.05810546875,
64
+ -0.51953125,
65
+ 0.24609375,
66
+ -0.11474609375
67
+ ],
68
+ [
69
+ -0.419921875,
70
+ 0.07763671875,
71
+ -0.49609375,
72
+ 0.2890625,
73
+ -0.056396484375
74
+ ],
75
+ [
76
+ -0.3984375,
77
+ 0.09619140625,
78
+ -0.51953125,
79
+ 0.33984375,
80
+ -0.14453125
81
+ ]
82
+ ],
83
+ [
84
+ [
85
+ 0.1396484375,
86
+ -0.54296875,
87
+ -0.248046875,
88
+ 0.4140625,
89
+ -1.0078125
90
+ ],
91
+ [
92
+ 0.1767578125,
93
+ -0.51953125,
94
+ -0.224609375,
95
+ 0.466796875,
96
+ -0.9453125
97
+ ],
98
+ [
99
+ 0.19921875,
100
+ -0.49609375,
101
+ -0.25,
102
+ 0.515625,
103
+ -1.0390625
104
+ ]
105
+ ]
106
+ ],
107
+ "training": {
108
+ "loss": 0.396484375,
109
+ "gradients": {
110
+ "embeddings.patch_embeddings.projection.weight": true,
111
+ "encoder.layer.0.attention.q_proj.weight": true
112
+ },
113
+ "updated": true
114
+ }
115
+ }
116
+ }
integrations/transformers/expectations/cpu-x86_64-bf16/dinov2-small.bfloat16.json ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/dinov2-small-mic",
4
+ "contract_name": "DINOv2",
5
+ "contract_revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
6
+ "framework": "transformers",
7
+ "variant": "bfloat16",
8
+ "target": "dinov2-small",
9
+ "kind": "checkpoint",
10
+ "revision": "ed25f3a31f01632728cabb09d1542f84ab7b0056",
11
+ "environment": {
12
+ "python": "3.11.18",
13
+ "transformers": "5.22.0.dev0",
14
+ "torch": "2.14.0+cpu",
15
+ "torchvision": "0.29.2+cpu",
16
+ "torchaudio": "2.11.1+cpu",
17
+ "tokenizers": "0.23.3",
18
+ "numpy": "2.3.5",
19
+ "pillow": "13.0.0",
20
+ "accelerate": "1.15.0",
21
+ "safetensors": "0.8.0",
22
+ "huggingface-hub": "2.3.0",
23
+ "sentencepiece": "0.2.2",
24
+ "protobuf": "7.36.2",
25
+ "librosa": "0.11.0",
26
+ "soundfile": "0.14.0",
27
+ "scipy": "1.17.1"
28
+ },
29
+ "seconds": 7.59,
30
+ "environment_differs": {
31
+ "torchvision": "0.29.2+cpu (pinned 0.29.1)",
32
+ "torchaudio": "2.11.1+cpu (pinned 2.11.0)",
33
+ "pillow": "13.0.0 (pinned 12.3.0)"
34
+ },
35
+ "platform": "cpu-x86_64-bf16"
36
+ },
37
+ "outputs": {
38
+ "runtime": {
39
+ "device": "cpu",
40
+ "dtype": "bfloat16",
41
+ "attn_implementation": "sdpa"
42
+ },
43
+ "cls_features": [
44
+ [
45
+ 3.25,
46
+ 1.390625,
47
+ 3.53125,
48
+ 0.6796875,
49
+ 1.0703125
50
+ ],
51
+ [
52
+ 2.71875,
53
+ 1.4921875,
54
+ 4.1875,
55
+ -1.125,
56
+ -0.75
57
+ ]
58
+ ],
59
+ "patch_features": [
60
+ [
61
+ [
62
+ 2.671875,
63
+ -2.4375,
64
+ 1.7109375,
65
+ -1.7421875,
66
+ 0.039306640625
67
+ ],
68
+ [
69
+ 2.65625,
70
+ -1.2734375,
71
+ 3.8125,
72
+ -3.71875,
73
+ -0.4921875
74
+ ],
75
+ [
76
+ 2.21875,
77
+ -6.4375,
78
+ 1.015625,
79
+ -1.9296875,
80
+ -0.181640625
81
+ ]
82
+ ],
83
+ [
84
+ [
85
+ 1.4921875,
86
+ -2.09375,
87
+ 3.234375,
88
+ -2.859375,
89
+ -0.64453125
90
+ ],
91
+ [
92
+ 0.50390625,
93
+ -1.6015625,
94
+ 3.828125,
95
+ -3.8125,
96
+ -1.5625
97
+ ],
98
+ [
99
+ 1.328125,
100
+ -5.9375,
101
+ 2.828125,
102
+ -3.0,
103
+ -1.4296875
104
+ ]
105
+ ]
106
+ ],
107
+ "training": {
108
+ "loss": 0.408203125,
109
+ "gradients": {
110
+ "embeddings.patch_embeddings.projection.weight": true,
111
+ "encoder.layer.0.attention.q_proj.weight": true
112
+ },
113
+ "updated": true
114
+ }
115
+ }
116
+ }
integrations/transformers/expectations/cpu-x86_64/dinov2-small-mic.eager.json ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/dinov2-small-mic",
4
+ "contract_name": "DINOv2",
5
+ "contract_revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
6
+ "framework": "transformers",
7
+ "variant": "eager",
8
+ "target": "dinov2-small-mic",
9
+ "kind": "fixture",
10
+ "revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
11
+ "environment": {
12
+ "python": "3.11.18",
13
+ "transformers": "5.22.0.dev0",
14
+ "torch": "2.14.0+cpu",
15
+ "torchvision": "0.29.2+cpu",
16
+ "torchaudio": "2.11.1+cpu",
17
+ "tokenizers": "0.23.3",
18
+ "numpy": "2.3.5",
19
+ "pillow": "13.0.0",
20
+ "accelerate": "1.15.0",
21
+ "safetensors": "0.8.0",
22
+ "huggingface-hub": "2.3.0",
23
+ "sentencepiece": "0.2.2",
24
+ "protobuf": "7.36.2",
25
+ "librosa": "0.11.0",
26
+ "soundfile": "0.14.0",
27
+ "scipy": "1.17.1"
28
+ },
29
+ "seconds": 7.33,
30
+ "environment_differs": {
31
+ "torchvision": "0.29.2+cpu (pinned 0.29.1)",
32
+ "torchaudio": "2.11.1+cpu (pinned 2.11.0)",
33
+ "pillow": "13.0.0 (pinned 12.3.0)"
34
+ },
35
+ "platform": "cpu-x86_64"
36
+ },
37
+ "outputs": {
38
+ "runtime": {
39
+ "device": "cpu",
40
+ "dtype": "float32",
41
+ "attn_implementation": "eager"
42
+ },
43
+ "cls_features": [
44
+ [
45
+ -1.2677825689315796,
46
+ 0.44753769040107727,
47
+ -0.9715877175331116,
48
+ -1.6918056011199951,
49
+ -0.10733163356781006
50
+ ],
51
+ [
52
+ -0.16284990310668945,
53
+ 0.6147457361221313,
54
+ -0.878085196018219,
55
+ -0.5765715837478638,
56
+ -0.34631210565567017
57
+ ]
58
+ ],
59
+ "patch_features": [
60
+ [
61
+ [
62
+ -0.4561893939971924,
63
+ 0.06119873747229576,
64
+ -0.5198690891265869,
65
+ 0.24606479704380035,
66
+ -0.11510999500751495
67
+ ],
68
+ [
69
+ -0.4219924509525299,
70
+ 0.0810282751917839,
71
+ -0.49528130888938904,
72
+ 0.2951686978340149,
73
+ -0.05753913149237633
74
+ ],
75
+ [
76
+ -0.4002307057380676,
77
+ 0.1002686396241188,
78
+ -0.5202704071998596,
79
+ 0.34013617038726807,
80
+ -0.14419952034950256
81
+ ]
82
+ ],
83
+ [
84
+ [
85
+ 0.13712136447429657,
86
+ -0.5413686037063599,
87
+ -0.25230535864830017,
88
+ 0.4157020151615143,
89
+ -1.0112773180007935
90
+ ],
91
+ [
92
+ 0.17359992861747742,
93
+ -0.5173826813697815,
94
+ -0.22490383684635162,
95
+ 0.46642279624938965,
96
+ -0.9491122364997864
97
+ ],
98
+ [
99
+ 0.19613665342330933,
100
+ -0.4979003071784973,
101
+ -0.25296491384506226,
102
+ 0.5143538117408752,
103
+ -1.0416719913482666
104
+ ]
105
+ ]
106
+ ],
107
+ "training": {
108
+ "loss": 0.3960122764110565,
109
+ "gradients": {
110
+ "embeddings.patch_embeddings.projection.weight": true,
111
+ "encoder.layer.0.attention.q_proj.weight": true
112
+ },
113
+ "updated": true
114
+ }
115
+ }
116
+ }
integrations/transformers/expectations/cpu-x86_64/dinov2-small-mic.json ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/dinov2-small-mic",
4
+ "contract_name": "DINOv2",
5
+ "contract_revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
6
+ "framework": "transformers",
7
+ "variant": "default",
8
+ "target": "dinov2-small-mic",
9
+ "kind": "fixture",
10
+ "revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
11
+ "environment": {
12
+ "python": "3.11.18",
13
+ "transformers": "5.22.0.dev0",
14
+ "torch": "2.14.0+cpu",
15
+ "torchvision": "0.29.2+cpu",
16
+ "torchaudio": "2.11.1+cpu",
17
+ "tokenizers": "0.23.3",
18
+ "numpy": "2.3.5",
19
+ "pillow": "13.0.0",
20
+ "accelerate": "1.15.0",
21
+ "safetensors": "0.8.0",
22
+ "huggingface-hub": "2.3.0",
23
+ "sentencepiece": "0.2.2",
24
+ "protobuf": "7.36.2",
25
+ "librosa": "0.11.0",
26
+ "soundfile": "0.14.0",
27
+ "scipy": "1.17.1"
28
+ },
29
+ "seconds": 7.19,
30
+ "environment_differs": {
31
+ "torchvision": "0.29.2+cpu (pinned 0.29.1)",
32
+ "torchaudio": "2.11.1+cpu (pinned 2.11.0)",
33
+ "pillow": "13.0.0 (pinned 12.3.0)"
34
+ },
35
+ "platform": "cpu-x86_64"
36
+ },
37
+ "outputs": {
38
+ "runtime": {
39
+ "device": "cpu",
40
+ "dtype": "float32",
41
+ "attn_implementation": "sdpa"
42
+ },
43
+ "cls_features": [
44
+ [
45
+ -1.2677828073501587,
46
+ 0.44753751158714294,
47
+ -0.9715878367424011,
48
+ -1.6918061971664429,
49
+ -0.10733203589916229
50
+ ],
51
+ [
52
+ -0.16284960508346558,
53
+ 0.6147460341453552,
54
+ -0.8780848383903503,
55
+ -0.5765717625617981,
56
+ -0.34631192684173584
57
+ ]
58
+ ],
59
+ "patch_features": [
60
+ [
61
+ [
62
+ -0.45618942379951477,
63
+ 0.06119873747229576,
64
+ -0.5198691487312317,
65
+ 0.24606478214263916,
66
+ -0.11511000990867615
67
+ ],
68
+ [
69
+ -0.4219924509525299,
70
+ 0.08102825284004211,
71
+ -0.49528130888938904,
72
+ 0.2951686382293701,
73
+ -0.057539138942956924
74
+ ],
75
+ [
76
+ -0.40023073554039,
77
+ 0.10026858747005463,
78
+ -0.5202704071998596,
79
+ 0.3401360809803009,
80
+ -0.14419953525066376
81
+ ]
82
+ ],
83
+ [
84
+ [
85
+ 0.13712137937545776,
86
+ -0.5413686037063599,
87
+ -0.2523052990436554,
88
+ 0.4157020151615143,
89
+ -1.0112773180007935
90
+ ],
91
+ [
92
+ 0.17359991371631622,
93
+ -0.5173826813697815,
94
+ -0.2249038815498352,
95
+ 0.46642276644706726,
96
+ -0.9491119980812073
97
+ ],
98
+ [
99
+ 0.19613665342330933,
100
+ -0.49790048599243164,
101
+ -0.25296491384506226,
102
+ 0.5143538117408752,
103
+ -1.0416719913482666
104
+ ]
105
+ ]
106
+ ],
107
+ "training": {
108
+ "loss": 0.39601224660873413,
109
+ "gradients": {
110
+ "embeddings.patch_embeddings.projection.weight": true,
111
+ "encoder.layer.0.attention.q_proj.weight": true
112
+ },
113
+ "updated": true
114
+ }
115
+ }
116
+ }
integrations/transformers/expectations/cpu-x86_64/dinov2-small.eager.json ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/dinov2-small-mic",
4
+ "contract_name": "DINOv2",
5
+ "contract_revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
6
+ "framework": "transformers",
7
+ "variant": "eager",
8
+ "target": "dinov2-small",
9
+ "kind": "checkpoint",
10
+ "revision": "ed25f3a31f01632728cabb09d1542f84ab7b0056",
11
+ "environment": {
12
+ "python": "3.11.18",
13
+ "transformers": "5.22.0.dev0",
14
+ "torch": "2.14.0+cpu",
15
+ "torchvision": "0.29.2+cpu",
16
+ "torchaudio": "2.11.1+cpu",
17
+ "tokenizers": "0.23.3",
18
+ "numpy": "2.3.5",
19
+ "pillow": "13.0.0",
20
+ "accelerate": "1.15.0",
21
+ "safetensors": "0.8.0",
22
+ "huggingface-hub": "2.3.0",
23
+ "sentencepiece": "0.2.2",
24
+ "protobuf": "7.36.2",
25
+ "librosa": "0.11.0",
26
+ "soundfile": "0.14.0",
27
+ "scipy": "1.17.1"
28
+ },
29
+ "seconds": 7.78,
30
+ "environment_differs": {
31
+ "torchvision": "0.29.2+cpu (pinned 0.29.1)",
32
+ "torchaudio": "2.11.1+cpu (pinned 2.11.0)",
33
+ "pillow": "13.0.0 (pinned 12.3.0)"
34
+ },
35
+ "platform": "cpu-x86_64"
36
+ },
37
+ "outputs": {
38
+ "runtime": {
39
+ "device": "cpu",
40
+ "dtype": "float32",
41
+ "attn_implementation": "eager"
42
+ },
43
+ "cls_features": [
44
+ [
45
+ 3.3632171154022217,
46
+ 1.3631565570831299,
47
+ 3.5031769275665283,
48
+ 0.7399592399597168,
49
+ 1.1561686992645264
50
+ ],
51
+ [
52
+ 2.873883008956909,
53
+ 1.558150291442871,
54
+ 4.299252033233643,
55
+ -1.1491706371307373,
56
+ -0.7426658868789673
57
+ ]
58
+ ],
59
+ "patch_features": [
60
+ [
61
+ [
62
+ 2.8144359588623047,
63
+ -2.566210985183716,
64
+ 1.6931791305541992,
65
+ -1.627620816230774,
66
+ 0.19263553619384766
67
+ ],
68
+ [
69
+ 2.8032729625701904,
70
+ -1.2689285278320312,
71
+ 3.8074841499328613,
72
+ -3.6497232913970947,
73
+ -0.40225517749786377
74
+ ],
75
+ [
76
+ 2.3764963150024414,
77
+ -6.332672119140625,
78
+ 0.9942713975906372,
79
+ -1.8182226419448853,
80
+ -0.050021421164274216
81
+ ]
82
+ ],
83
+ [
84
+ [
85
+ 1.7134679555892944,
86
+ -2.1021156311035156,
87
+ 3.2496793270111084,
88
+ -2.8441338539123535,
89
+ -0.6768681406974792
90
+ ],
91
+ [
92
+ 0.6792188882827759,
93
+ -1.5355024337768555,
94
+ 4.053866863250732,
95
+ -3.7946765422821045,
96
+ -1.4759902954101562
97
+ ],
98
+ [
99
+ 1.5326447486877441,
100
+ -5.820225238800049,
101
+ 2.909334659576416,
102
+ -2.9413650035858154,
103
+ -1.2621461153030396
104
+ ]
105
+ ]
106
+ ],
107
+ "training": {
108
+ "loss": 0.40739622712135315,
109
+ "gradients": {
110
+ "embeddings.patch_embeddings.projection.weight": true,
111
+ "encoder.layer.0.attention.q_proj.weight": true
112
+ },
113
+ "updated": true
114
+ }
115
+ }
116
+ }
integrations/transformers/expectations/cpu-x86_64/dinov2-small.json ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/dinov2-small-mic",
4
+ "contract_name": "DINOv2",
5
+ "contract_revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
6
+ "framework": "transformers",
7
+ "variant": "default",
8
+ "target": "dinov2-small",
9
+ "kind": "checkpoint",
10
+ "revision": "ed25f3a31f01632728cabb09d1542f84ab7b0056",
11
+ "environment": {
12
+ "python": "3.11.18",
13
+ "transformers": "5.22.0.dev0",
14
+ "torch": "2.14.0+cpu",
15
+ "torchvision": "0.29.2+cpu",
16
+ "torchaudio": "2.11.1+cpu",
17
+ "tokenizers": "0.23.3",
18
+ "numpy": "2.3.5",
19
+ "pillow": "13.0.0",
20
+ "accelerate": "1.15.0",
21
+ "safetensors": "0.8.0",
22
+ "huggingface-hub": "2.3.0",
23
+ "sentencepiece": "0.2.2",
24
+ "protobuf": "7.36.2",
25
+ "librosa": "0.11.0",
26
+ "soundfile": "0.14.0",
27
+ "scipy": "1.17.1"
28
+ },
29
+ "seconds": 7.78,
30
+ "environment_differs": {
31
+ "torchvision": "0.29.2+cpu (pinned 0.29.1)",
32
+ "torchaudio": "2.11.1+cpu (pinned 2.11.0)",
33
+ "pillow": "13.0.0 (pinned 12.3.0)"
34
+ },
35
+ "platform": "cpu-x86_64"
36
+ },
37
+ "outputs": {
38
+ "runtime": {
39
+ "device": "cpu",
40
+ "dtype": "float32",
41
+ "attn_implementation": "sdpa"
42
+ },
43
+ "cls_features": [
44
+ [
45
+ 3.363215684890747,
46
+ 1.363155484199524,
47
+ 3.503181219100952,
48
+ 0.7399603128433228,
49
+ 1.1561681032180786
50
+ ],
51
+ [
52
+ 2.8738789558410645,
53
+ 1.5581508874893188,
54
+ 4.299252033233643,
55
+ -1.1491740942001343,
56
+ -0.7426685690879822
57
+ ]
58
+ ],
59
+ "patch_features": [
60
+ [
61
+ [
62
+ 2.8144359588623047,
63
+ -2.566210985183716,
64
+ 1.6931726932525635,
65
+ -1.6276195049285889,
66
+ 0.1926337629556656
67
+ ],
68
+ [
69
+ 2.8032710552215576,
70
+ -1.2689297199249268,
71
+ 3.8074841499328613,
72
+ -3.6497254371643066,
73
+ -0.40224969387054443
74
+ ],
75
+ [
76
+ 2.3764944076538086,
77
+ -6.33266544342041,
78
+ 0.9942771792411804,
79
+ -1.8182300329208374,
80
+ -0.05001138150691986
81
+ ]
82
+ ],
83
+ [
84
+ [
85
+ 1.7134637832641602,
86
+ -2.102106809616089,
87
+ 3.249678373336792,
88
+ -2.844135284423828,
89
+ -0.6768750548362732
90
+ ],
91
+ [
92
+ 0.6792117357254028,
93
+ -1.5354945659637451,
94
+ 4.053877830505371,
95
+ -3.7946696281433105,
96
+ -1.475988745689392
97
+ ],
98
+ [
99
+ 1.5326398611068726,
100
+ -5.820218086242676,
101
+ 2.909342050552368,
102
+ -2.9413583278656006,
103
+ -1.2621601819992065
104
+ ]
105
+ ]
106
+ ],
107
+ "training": {
108
+ "loss": 0.40739724040031433,
109
+ "gradients": {
110
+ "embeddings.patch_embeddings.projection.weight": true,
111
+ "encoder.layer.0.attention.q_proj.weight": true
112
+ },
113
+ "updated": true
114
+ }
115
+ }
116
+ }
integrations/transformers/expectations/cuda/dinov2-small-mic.bfloat16.json ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/dinov2-small-mic",
4
+ "contract_name": "DINOv2",
5
+ "contract_revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
6
+ "framework": "transformers",
7
+ "variant": "bfloat16",
8
+ "target": "dinov2-small-mic",
9
+ "kind": "fixture",
10
+ "revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
11
+ "environment": {
12
+ "python": "3.11.18",
13
+ "transformers": "5.22.0.dev0",
14
+ "torch": "2.14.0+cu130",
15
+ "torchvision": "0.29.2",
16
+ "torchaudio": "2.11.0+cu130",
17
+ "tokenizers": "0.23.3",
18
+ "numpy": "2.4.6",
19
+ "pillow": "13.0.0",
20
+ "accelerate": "1.16.0.dev0",
21
+ "safetensors": "0.8.0",
22
+ "huggingface-hub": "2.3.0",
23
+ "sentencepiece": "0.2.2",
24
+ "protobuf": "7.36.2",
25
+ "librosa": "0.11.0",
26
+ "soundfile": "0.14.0",
27
+ "scipy": "1.17.1"
28
+ },
29
+ "seconds": 7.17,
30
+ "environment_differs": {
31
+ "torchvision": "0.29.2 (pinned 0.29.1)",
32
+ "numpy": "2.4.6 (pinned 2.3.5)",
33
+ "pillow": "13.0.0 (pinned 12.3.0)",
34
+ "accelerate": "1.16.0.dev0 (pinned 1.15.0)"
35
+ },
36
+ "platform": "cuda"
37
+ },
38
+ "outputs": {
39
+ "runtime": {
40
+ "device": "cuda",
41
+ "dtype": "bfloat16",
42
+ "attn_implementation": "sdpa"
43
+ },
44
+ "cls_features": [
45
+ [
46
+ -1.265625,
47
+ 0.451171875,
48
+ -0.9765625,
49
+ -1.6953125,
50
+ -0.11083984375
51
+ ],
52
+ [
53
+ -0.158203125,
54
+ 0.625,
55
+ -0.875,
56
+ -0.56640625,
57
+ -0.345703125
58
+ ]
59
+ ],
60
+ "patch_features": [
61
+ [
62
+ [
63
+ -0.458984375,
64
+ 0.05810546875,
65
+ -0.51953125,
66
+ 0.24609375,
67
+ -0.11474609375
68
+ ],
69
+ [
70
+ -0.419921875,
71
+ 0.0771484375,
72
+ -0.49609375,
73
+ 0.2890625,
74
+ -0.056396484375
75
+ ],
76
+ [
77
+ -0.3984375,
78
+ 0.09619140625,
79
+ -0.51953125,
80
+ 0.33984375,
81
+ -0.14453125
82
+ ]
83
+ ],
84
+ [
85
+ [
86
+ 0.1396484375,
87
+ -0.54296875,
88
+ -0.248046875,
89
+ 0.4140625,
90
+ -1.0078125
91
+ ],
92
+ [
93
+ 0.1767578125,
94
+ -0.51953125,
95
+ -0.224609375,
96
+ 0.466796875,
97
+ -0.9453125
98
+ ],
99
+ [
100
+ 0.19921875,
101
+ -0.49609375,
102
+ -0.25,
103
+ 0.515625,
104
+ -1.0390625
105
+ ]
106
+ ]
107
+ ],
108
+ "training": {
109
+ "loss": 0.396484375,
110
+ "gradients": {
111
+ "embeddings.patch_embeddings.projection.weight": true,
112
+ "encoder.layer.0.attention.q_proj.weight": true
113
+ },
114
+ "updated": true
115
+ }
116
+ }
117
+ }
integrations/transformers/expectations/cuda/dinov2-small-mic.eager.json ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/dinov2-small-mic",
4
+ "contract_name": "DINOv2",
5
+ "contract_revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
6
+ "framework": "transformers",
7
+ "variant": "eager",
8
+ "target": "dinov2-small-mic",
9
+ "kind": "fixture",
10
+ "revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
11
+ "environment": {
12
+ "python": "3.11.18",
13
+ "transformers": "5.22.0.dev0",
14
+ "torch": "2.14.0+cu130",
15
+ "torchvision": "0.29.2",
16
+ "torchaudio": "2.11.0+cu130",
17
+ "tokenizers": "0.23.3",
18
+ "numpy": "2.4.6",
19
+ "pillow": "13.0.0",
20
+ "accelerate": "1.16.0.dev0",
21
+ "safetensors": "0.8.0",
22
+ "huggingface-hub": "2.3.0",
23
+ "sentencepiece": "0.2.2",
24
+ "protobuf": "7.36.2",
25
+ "librosa": "0.11.0",
26
+ "soundfile": "0.14.0",
27
+ "scipy": "1.17.1"
28
+ },
29
+ "seconds": 7.24,
30
+ "environment_differs": {
31
+ "torchvision": "0.29.2 (pinned 0.29.1)",
32
+ "numpy": "2.4.6 (pinned 2.3.5)",
33
+ "pillow": "13.0.0 (pinned 12.3.0)",
34
+ "accelerate": "1.16.0.dev0 (pinned 1.15.0)"
35
+ },
36
+ "platform": "cuda"
37
+ },
38
+ "outputs": {
39
+ "runtime": {
40
+ "device": "cuda",
41
+ "dtype": "float32",
42
+ "attn_implementation": "eager"
43
+ },
44
+ "cls_features": [
45
+ [
46
+ -1.2679601907730103,
47
+ 0.44750577211380005,
48
+ -0.971464216709137,
49
+ -1.6919364929199219,
50
+ -0.10752461850643158
51
+ ],
52
+ [
53
+ -0.16286683082580566,
54
+ 0.6150127053260803,
55
+ -0.8777503371238708,
56
+ -0.5766773223876953,
57
+ -0.34621816873550415
58
+ ]
59
+ ],
60
+ "patch_features": [
61
+ [
62
+ [
63
+ -0.45605921745300293,
64
+ 0.060752131044864655,
65
+ -0.5195971727371216,
66
+ 0.246177077293396,
67
+ -0.11525414139032364
68
+ ],
69
+ [
70
+ -0.4218588173389435,
71
+ 0.08058323711156845,
72
+ -0.49500611424446106,
73
+ 0.2952865958213806,
74
+ -0.05767730250954628
75
+ ],
76
+ [
77
+ -0.40009447932243347,
78
+ 0.09982605278491974,
79
+ -0.51999831199646,
80
+ 0.3402586579322815,
81
+ -0.1443466991186142
82
+ ]
83
+ ],
84
+ [
85
+ [
86
+ 0.13699482381343842,
87
+ -0.5414605736732483,
88
+ -0.25245267152786255,
89
+ 0.4158841669559479,
90
+ -1.0113370418548584
91
+ ],
92
+ [
93
+ 0.17346715927124023,
94
+ -0.5174773931503296,
95
+ -0.22505569458007812,
96
+ 0.4665941894054413,
97
+ -0.949180006980896
98
+ ],
99
+ [
100
+ 0.19600003957748413,
101
+ -0.4979996383190155,
102
+ -0.25311195850372314,
103
+ 0.5145183801651001,
104
+ -1.0417256355285645
105
+ ]
106
+ ]
107
+ ],
108
+ "training": {
109
+ "loss": 0.3959294557571411,
110
+ "gradients": {
111
+ "embeddings.patch_embeddings.projection.weight": true,
112
+ "encoder.layer.0.attention.q_proj.weight": true
113
+ },
114
+ "updated": true
115
+ }
116
+ }
117
+ }
integrations/transformers/expectations/cuda/dinov2-small-mic.json ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/dinov2-small-mic",
4
+ "contract_name": "DINOv2",
5
+ "contract_revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
6
+ "framework": "transformers",
7
+ "variant": "default",
8
+ "target": "dinov2-small-mic",
9
+ "kind": "fixture",
10
+ "revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
11
+ "environment": {
12
+ "python": "3.11.18",
13
+ "transformers": "5.22.0.dev0",
14
+ "torch": "2.14.0+cu130",
15
+ "torchvision": "0.29.2",
16
+ "torchaudio": "2.11.0+cu130",
17
+ "tokenizers": "0.23.3",
18
+ "numpy": "2.4.6",
19
+ "pillow": "13.0.0",
20
+ "accelerate": "1.16.0.dev0",
21
+ "safetensors": "0.8.0",
22
+ "huggingface-hub": "2.3.0",
23
+ "sentencepiece": "0.2.2",
24
+ "protobuf": "7.36.2",
25
+ "librosa": "0.11.0",
26
+ "soundfile": "0.14.0",
27
+ "scipy": "1.17.1"
28
+ },
29
+ "seconds": 7.32,
30
+ "environment_differs": {
31
+ "torchvision": "0.29.2 (pinned 0.29.1)",
32
+ "numpy": "2.4.6 (pinned 2.3.5)",
33
+ "pillow": "13.0.0 (pinned 12.3.0)",
34
+ "accelerate": "1.16.0.dev0 (pinned 1.15.0)"
35
+ },
36
+ "platform": "cuda"
37
+ },
38
+ "outputs": {
39
+ "runtime": {
40
+ "device": "cuda",
41
+ "dtype": "float32",
42
+ "attn_implementation": "sdpa"
43
+ },
44
+ "cls_features": [
45
+ [
46
+ -1.2679606676101685,
47
+ 0.4475054442882538,
48
+ -0.9714641571044922,
49
+ -1.6919360160827637,
50
+ -0.10752378404140472
51
+ ],
52
+ [
53
+ -0.16286709904670715,
54
+ 0.615013062953949,
55
+ -0.8777508735656738,
56
+ -0.5766777396202087,
57
+ -0.34621813893318176
58
+ ]
59
+ ],
60
+ "patch_features": [
61
+ [
62
+ [
63
+ -0.45605921745300293,
64
+ 0.060752153396606445,
65
+ -0.5195971131324768,
66
+ 0.2461770921945572,
67
+ -0.11525411903858185
68
+ ],
69
+ [
70
+ -0.4218587279319763,
71
+ 0.08058319985866547,
72
+ -0.4950060546398163,
73
+ 0.2952865660190582,
74
+ -0.05767732858657837
75
+ ],
76
+ [
77
+ -0.4000944495201111,
78
+ 0.09982606023550034,
79
+ -0.5199982523918152,
80
+ 0.3402586579322815,
81
+ -0.14434663951396942
82
+ ]
83
+ ],
84
+ [
85
+ [
86
+ 0.13699479401111603,
87
+ -0.5414605736732483,
88
+ -0.2524527311325073,
89
+ 0.4158841669559479,
90
+ -1.0113370418548584
91
+ ],
92
+ [
93
+ 0.17346712946891785,
94
+ -0.5174773931503296,
95
+ -0.2250557243824005,
96
+ 0.46659424901008606,
97
+ -0.9491799473762512
98
+ ],
99
+ [
100
+ 0.19600002467632294,
101
+ -0.49799954891204834,
102
+ -0.2531120479106903,
103
+ 0.5145183801651001,
104
+ -1.041725754737854
105
+ ]
106
+ ]
107
+ ],
108
+ "training": {
109
+ "loss": 0.395929217338562,
110
+ "gradients": {
111
+ "embeddings.patch_embeddings.projection.weight": true,
112
+ "encoder.layer.0.attention.q_proj.weight": true
113
+ },
114
+ "updated": true
115
+ }
116
+ }
117
+ }
integrations/transformers/expectations/cuda/dinov2-small.bfloat16.json ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/dinov2-small-mic",
4
+ "contract_name": "DINOv2",
5
+ "contract_revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
6
+ "framework": "transformers",
7
+ "variant": "bfloat16",
8
+ "target": "dinov2-small",
9
+ "kind": "checkpoint",
10
+ "revision": "ed25f3a31f01632728cabb09d1542f84ab7b0056",
11
+ "environment": {
12
+ "python": "3.11.18",
13
+ "transformers": "5.22.0.dev0",
14
+ "torch": "2.14.0+cu130",
15
+ "torchvision": "0.29.2",
16
+ "torchaudio": "2.11.0+cu130",
17
+ "tokenizers": "0.23.3",
18
+ "numpy": "2.4.6",
19
+ "pillow": "13.0.0",
20
+ "accelerate": "1.16.0.dev0",
21
+ "safetensors": "0.8.0",
22
+ "huggingface-hub": "2.3.0",
23
+ "sentencepiece": "0.2.2",
24
+ "protobuf": "7.36.2",
25
+ "librosa": "0.11.0",
26
+ "soundfile": "0.14.0",
27
+ "scipy": "1.17.1"
28
+ },
29
+ "seconds": 6.99,
30
+ "environment_differs": {
31
+ "torchvision": "0.29.2 (pinned 0.29.1)",
32
+ "numpy": "2.4.6 (pinned 2.3.5)",
33
+ "pillow": "13.0.0 (pinned 12.3.0)",
34
+ "accelerate": "1.16.0.dev0 (pinned 1.15.0)"
35
+ },
36
+ "platform": "cuda"
37
+ },
38
+ "outputs": {
39
+ "runtime": {
40
+ "device": "cuda",
41
+ "dtype": "bfloat16",
42
+ "attn_implementation": "sdpa"
43
+ },
44
+ "cls_features": [
45
+ [
46
+ 3.234375,
47
+ 1.421875,
48
+ 3.53125,
49
+ 0.671875,
50
+ 1.109375
51
+ ],
52
+ [
53
+ 2.75,
54
+ 1.4765625,
55
+ 4.21875,
56
+ -1.1015625,
57
+ -0.7421875
58
+ ]
59
+ ],
60
+ "patch_features": [
61
+ [
62
+ [
63
+ 2.640625,
64
+ -2.578125,
65
+ 1.7109375,
66
+ -1.75,
67
+ 0.1455078125
68
+ ],
69
+ [
70
+ 2.640625,
71
+ -1.2734375,
72
+ 3.765625,
73
+ -3.75,
74
+ -0.37890625
75
+ ],
76
+ [
77
+ 2.1875,
78
+ -6.3125,
79
+ 1.0859375,
80
+ -2.015625,
81
+ -0.09228515625
82
+ ]
83
+ ],
84
+ [
85
+ [
86
+ 1.4921875,
87
+ -2.125,
88
+ 3.1875,
89
+ -2.796875,
90
+ -0.59765625
91
+ ],
92
+ [
93
+ 0.5234375,
94
+ -1.6875,
95
+ 3.90625,
96
+ -3.75,
97
+ -1.53125
98
+ ],
99
+ [
100
+ 1.375,
101
+ -5.9375,
102
+ 2.71875,
103
+ -2.875,
104
+ -1.3125
105
+ ]
106
+ ]
107
+ ],
108
+ "training": {
109
+ "loss": 0.41796875,
110
+ "gradients": {
111
+ "embeddings.patch_embeddings.projection.weight": true,
112
+ "encoder.layer.0.attention.q_proj.weight": true
113
+ },
114
+ "updated": true
115
+ }
116
+ }
117
+ }
integrations/transformers/expectations/cuda/dinov2-small.eager.json ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/dinov2-small-mic",
4
+ "contract_name": "DINOv2",
5
+ "contract_revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
6
+ "framework": "transformers",
7
+ "variant": "eager",
8
+ "target": "dinov2-small",
9
+ "kind": "checkpoint",
10
+ "revision": "ed25f3a31f01632728cabb09d1542f84ab7b0056",
11
+ "environment": {
12
+ "python": "3.11.18",
13
+ "transformers": "5.22.0.dev0",
14
+ "torch": "2.14.0+cu130",
15
+ "torchvision": "0.29.2",
16
+ "torchaudio": "2.11.0+cu130",
17
+ "tokenizers": "0.23.3",
18
+ "numpy": "2.4.6",
19
+ "pillow": "13.0.0",
20
+ "accelerate": "1.16.0.dev0",
21
+ "safetensors": "0.8.0",
22
+ "huggingface-hub": "2.3.0",
23
+ "sentencepiece": "0.2.2",
24
+ "protobuf": "7.36.2",
25
+ "librosa": "0.11.0",
26
+ "soundfile": "0.14.0",
27
+ "scipy": "1.17.1"
28
+ },
29
+ "seconds": 6.92,
30
+ "environment_differs": {
31
+ "torchvision": "0.29.2 (pinned 0.29.1)",
32
+ "numpy": "2.4.6 (pinned 2.3.5)",
33
+ "pillow": "13.0.0 (pinned 12.3.0)",
34
+ "accelerate": "1.16.0.dev0 (pinned 1.15.0)"
35
+ },
36
+ "platform": "cuda"
37
+ },
38
+ "outputs": {
39
+ "runtime": {
40
+ "device": "cuda",
41
+ "dtype": "float32",
42
+ "attn_implementation": "eager"
43
+ },
44
+ "cls_features": [
45
+ [
46
+ 3.3632185459136963,
47
+ 1.3631588220596313,
48
+ 3.503180980682373,
49
+ 0.7399594187736511,
50
+ 1.1561698913574219
51
+ ],
52
+ [
53
+ 2.8738818168640137,
54
+ 1.5581567287445068,
55
+ 4.299259662628174,
56
+ -1.1491749286651611,
57
+ -0.742664635181427
58
+ ]
59
+ ],
60
+ "patch_features": [
61
+ [
62
+ [
63
+ 2.8144304752349854,
64
+ -2.5662131309509277,
65
+ 1.6931780576705933,
66
+ -1.62762451171875,
67
+ 0.19264210760593414
68
+ ],
69
+ [
70
+ 2.803272008895874,
71
+ -1.2689350843429565,
72
+ 3.8074729442596436,
73
+ -3.649724245071411,
74
+ -0.4022521674633026
75
+ ],
76
+ [
77
+ 2.3764851093292236,
78
+ -6.3326802253723145,
79
+ 0.9942670464515686,
80
+ -1.8182239532470703,
81
+ -0.0500158928334713
82
+ ]
83
+ ],
84
+ [
85
+ [
86
+ 1.7134647369384766,
87
+ -2.102114200592041,
88
+ 3.249678373336792,
89
+ -2.8441355228424072,
90
+ -0.6768700480461121
91
+ ],
92
+ [
93
+ 0.6792080998420715,
94
+ -1.5354911088943481,
95
+ 4.0538835525512695,
96
+ -3.7946691513061523,
97
+ -1.4759985208511353
98
+ ],
99
+ [
100
+ 1.5326409339904785,
101
+ -5.820221900939941,
102
+ 2.909335136413574,
103
+ -2.9413630962371826,
104
+ -1.2621474266052246
105
+ ]
106
+ ]
107
+ ],
108
+ "training": {
109
+ "loss": 0.40739744901657104,
110
+ "gradients": {
111
+ "embeddings.patch_embeddings.projection.weight": true,
112
+ "encoder.layer.0.attention.q_proj.weight": true
113
+ },
114
+ "updated": true
115
+ }
116
+ }
117
+ }
integrations/transformers/expectations/cuda/dinov2-small.json ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/dinov2-small-mic",
4
+ "contract_name": "DINOv2",
5
+ "contract_revision": "2551b1df5f6f8020ee15b17aa9b7549e364fbfdb",
6
+ "framework": "transformers",
7
+ "variant": "default",
8
+ "target": "dinov2-small",
9
+ "kind": "checkpoint",
10
+ "revision": "ed25f3a31f01632728cabb09d1542f84ab7b0056",
11
+ "environment": {
12
+ "python": "3.11.18",
13
+ "transformers": "5.22.0.dev0",
14
+ "torch": "2.14.0+cu130",
15
+ "torchvision": "0.29.2",
16
+ "torchaudio": "2.11.0+cu130",
17
+ "tokenizers": "0.23.3",
18
+ "numpy": "2.4.6",
19
+ "pillow": "13.0.0",
20
+ "accelerate": "1.16.0.dev0",
21
+ "safetensors": "0.8.0",
22
+ "huggingface-hub": "2.3.0",
23
+ "sentencepiece": "0.2.2",
24
+ "protobuf": "7.36.2",
25
+ "librosa": "0.11.0",
26
+ "soundfile": "0.14.0",
27
+ "scipy": "1.17.1"
28
+ },
29
+ "seconds": 6.67,
30
+ "environment_differs": {
31
+ "torchvision": "0.29.2 (pinned 0.29.1)",
32
+ "numpy": "2.4.6 (pinned 2.3.5)",
33
+ "pillow": "13.0.0 (pinned 12.3.0)",
34
+ "accelerate": "1.16.0.dev0 (pinned 1.15.0)"
35
+ },
36
+ "platform": "cuda"
37
+ },
38
+ "outputs": {
39
+ "runtime": {
40
+ "device": "cuda",
41
+ "dtype": "float32",
42
+ "attn_implementation": "sdpa"
43
+ },
44
+ "cls_features": [
45
+ [
46
+ 3.3632168769836426,
47
+ 1.3631563186645508,
48
+ 3.503182888031006,
49
+ 0.7399498820304871,
50
+ 1.1561646461486816
51
+ ],
52
+ [
53
+ 2.8738813400268555,
54
+ 1.5581508874893188,
55
+ 4.299262523651123,
56
+ -1.1491715908050537,
57
+ -0.7426652908325195
58
+ ]
59
+ ],
60
+ "patch_features": [
61
+ [
62
+ [
63
+ 2.81443452835083,
64
+ -2.5662147998809814,
65
+ 1.6931688785552979,
66
+ -1.627625823020935,
67
+ 0.19263756275177002
68
+ ],
69
+ [
70
+ 2.803272247314453,
71
+ -1.2689265012741089,
72
+ 3.8074750900268555,
73
+ -3.6497342586517334,
74
+ -0.40226009488105774
75
+ ],
76
+ [
77
+ 2.376483201980591,
78
+ -6.33268404006958,
79
+ 0.9942582845687866,
80
+ -1.8182166814804077,
81
+ -0.05002152547240257
82
+ ]
83
+ ],
84
+ [
85
+ [
86
+ 1.7134617567062378,
87
+ -2.102113723754883,
88
+ 3.2496745586395264,
89
+ -2.8441359996795654,
90
+ -0.6768668293952942
91
+ ],
92
+ [
93
+ 0.6792129874229431,
94
+ -1.5354958772659302,
95
+ 4.0538763999938965,
96
+ -3.794677734375,
97
+ -1.4759998321533203
98
+ ],
99
+ [
100
+ 1.5326385498046875,
101
+ -5.820228099822998,
102
+ 2.9093282222747803,
103
+ -2.941356897354126,
104
+ -1.2621431350708008
105
+ ]
106
+ ]
107
+ ],
108
+ "training": {
109
+ "loss": 0.40739744901657104,
110
+ "gradients": {
111
+ "embeddings.patch_embeddings.projection.weight": true,
112
+ "encoder.layer.0.attention.q_proj.weight": true
113
+ },
114
+ "updated": true
115
+ }
116
+ }
117
+ }
integrations/transformers/usage.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DINOv2: image features with Transformers
2
+
3
+ This page is the Transformers contract of the DINOv2 MIC and also a usage example. [doc-builder](https://github.com/huggingface/doc-builder/blob/main/docs/runnable-code-blocks.md) renders the `runnable` blocks below as documentation, and its pytest plugin runs them as written against `facebook/dinov2-small`. The MIC runner runs the same blocks against the slim fixture and the checkpoint in [`integration.json`](../../integration.json). Lines marked `# doc-builder: hide` only matter there: they swap in the pinned checkpoint or variant and print the result record.
4
+
5
+ ## Extract image features
6
+
7
+ ```py runnable:dinov2
8
+ import torch
9
+ from transformers import AutoImageProcessor, AutoModel, set_seed
10
+ from PIL import Image
11
+ import json # doc-builder: hide
12
+ import os # doc-builder: hide
13
+
14
+ model_id = "facebook/dinov2-small"
15
+ model_id = os.environ.get("MIC_MODEL", model_id) # doc-builder: hide
16
+ variant = json.loads(os.environ.get("MIC_MODEL_KWARGS", "{}")) # doc-builder: hide
17
+ device = "cuda" if torch.cuda.is_available() else "cpu"
18
+ set_seed(0) # seeds torch, NumPy, and Python: loading and any dropout draw random numbers
19
+
20
+ processor = AutoImageProcessor.from_pretrained(model_id)
21
+ model = AutoModel.from_pretrained(model_id).to(device)
22
+ if variant: # doc-builder: hide
23
+ del model # doc-builder: hide
24
+ model = AutoModel.from_pretrained(model_id, **variant).to(device) # doc-builder: hide
25
+ model.eval()
26
+
27
+ # Two synthetic images: a red square and a blue square, distinct enough that a batch probe is meaningful.
28
+ images = [Image.new("RGB", (224, 224), (200, 30, 30)), Image.new("RGB", (224, 224), (30, 30, 200))]
29
+ inputs = processor(images=images, return_tensors="pt")
30
+ inputs = inputs.to(device, dtype=model.dtype) # pixel_values are float: cast to the model dtype
31
+
32
+ with torch.no_grad():
33
+ outputs = model(**inputs)
34
+
35
+ cls_features = outputs.last_hidden_state[:, 0, :5].float()
36
+ patch_features = outputs.last_hidden_state[:, 1:4, :5].float()
37
+ print("cls:", cls_features.tolist())
38
+ print("patches:", patch_features.tolist())
39
+ ```
40
+
41
+ ## One training step
42
+
43
+ ```py runnable:dinov2:2
44
+ # A small seeded SGD step on the CLS token: the target is the mean of the batch's own CLS features,
45
+ # so the loss is well defined without external labels.
46
+ model.train()
47
+ optimizer = torch.optim.SGD([p for p in model.parameters() if p.requires_grad], lr=0.01)
48
+
49
+ with torch.no_grad():
50
+ target = outputs.last_hidden_state[:, 0, :].mean(dim=0, keepdim=True).detach()
51
+
52
+ loss = torch.nn.functional.mse_loss(model(**inputs).last_hidden_state[:, 0, :], target.expand_as(model(**inputs).last_hidden_state[:, 0, :]))
53
+ loss.backward()
54
+ before = {n: p.detach().cpu().clone() for n, p in model.named_parameters() if p.requires_grad} # doc-builder: hide
55
+ optimizer.step()
56
+ print(f"loss: {loss.item():.4f}")
57
+
58
+ if os.environ.get("MIC_RUNNER"): # doc-builder: hide
59
+ named = dict(model.named_parameters())
60
+ checked = ("embeddings.patch_embeddings.projection.weight", "encoder.layer.0.attention.q_proj.weight")
61
+ result = {
62
+ "runtime": {
63
+ "device": model.device.type,
64
+ "dtype": str(model.dtype).removeprefix("torch."),
65
+ "attn_implementation": model.config._attn_implementation,
66
+ },
67
+ "cls_features": cls_features.tolist(),
68
+ "patch_features": patch_features.tolist(),
69
+ "training": {
70
+ "loss": loss.item(),
71
+ "gradients": {n: bool(named[n].grad is not None and torch.count_nonzero(named[n].grad) > 0 and torch.isfinite(named[n].grad).all()) for n in checked},
72
+ "updated": any(not torch.equal(p.detach().cpu(), before[n]) for n, p in model.named_parameters() if n in before),
73
+ },
74
+ }
75
+ print(json.dumps(result))
76
+ ```
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3912762cb2c791b01d4b9b5b7cd51c5562cd6a1d3ad9448ff4c1a92efc753ed
3
+ size 907728
preprocessor_config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": {
3
+ "height": 224,
4
+ "width": 224
5
+ },
6
+ "do_center_crop": true,
7
+ "do_convert_rgb": true,
8
+ "do_normalize": true,
9
+ "do_rescale": true,
10
+ "do_resize": true,
11
+ "image_mean": [
12
+ 0.485,
13
+ 0.456,
14
+ 0.406
15
+ ],
16
+ "image_processor_type": "BitImageProcessor",
17
+ "image_std": [
18
+ 0.229,
19
+ 0.224,
20
+ 0.225
21
+ ],
22
+ "resample": 3,
23
+ "rescale_factor": 0.00392156862745098,
24
+ "size": {
25
+ "shortest_edge": 256
26
+ }
27
+ }