tarekziade HF Staff commited on
Commit
daf3b50
·
verified ·
1 Parent(s): 3d1d428

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: google/mt5-small
6
+ ---
7
+
8
+ # mt5-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
+ ### MT5 seq2seq
20
+
21
+ Runnable usage and the framework expectations directory are linked above.
22
+
23
+ ## Slim model
24
+
25
+ ### Slim fixture: mt5-small-mic
26
+
27
+ A 16.2M-parameter fixture for the [MT5 MIC](https://huggingface.co/huggingface-mic/mt5-small-mic), covering [`google/mt5-small`](https://huggingface.co/google/mt5-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 `d4db27680832`.** It covers every checkpoint whose processor files are byte-identical and whose config matches after shrinking.
30
+ - **Same architecture, smaller config:** `MT5ForConditionalGeneration`, shrunk by the generic rule in [`sweep.py`](https://github.com/huggingface/transformers-mic/blob/main/experiments/sweep.py) (num_layers 2, num_decoder_layers 2).
31
+ - **Processor files copied byte for byte** from `google/mt5-small`: `generation_config.json`, `special_tokens_map.json`, `spiece.model`, `tokenizer_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: `input_ids:reverse`, 1.85), 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 `google/mt5-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 mt5-small-mic`.
build.json ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fixture": "huggingface-mic/mt5-small-mic",
3
+ "key": "d4db27680832eff40006790f63dcf30b82bdc90e3e9111cca91a8a480e15a9aa",
4
+ "key_fields": {
5
+ "architectures": [
6
+ "MT5ForConditionalGeneration"
7
+ ],
8
+ "output_hidden_states": false,
9
+ "return_dict": true,
10
+ "chunk_size_feed_forward": 0,
11
+ "is_encoder_decoder": true,
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
+ "vocab_size": 250112,
22
+ "d_model": 64,
23
+ "d_kv": 16,
24
+ "d_ff": 128,
25
+ "num_layers": 2,
26
+ "num_decoder_layers": 2,
27
+ "num_heads": 4,
28
+ "relative_attention_num_buckets": 32,
29
+ "relative_attention_max_distance": 128,
30
+ "dropout_rate": 0.1,
31
+ "layer_norm_epsilon": 1e-06,
32
+ "initializer_factor": 1.0,
33
+ "feed_forward_proj": "gated-gelu",
34
+ "use_cache": true,
35
+ "tie_word_embeddings": true,
36
+ "bos_token_id": null,
37
+ "pad_token_id": 0,
38
+ "eos_token_id": 1,
39
+ "decoder_start_token_id": 0,
40
+ "classifier_dropout": 0.0,
41
+ "is_decoder": false,
42
+ "dense_act_fn": "gelu_new",
43
+ "is_gated_act": true,
44
+ "model_type": "mt5",
45
+ "tokenizer_class": "T5Tokenizer",
46
+ "output_attentions": false
47
+ },
48
+ "covers": {
49
+ "google/mt5-small": "73fb5dbe4756edadc8fbe8c769b0a109493acf7a"
50
+ },
51
+ "built_from": {
52
+ "repo": "google/mt5-small",
53
+ "revision": "73fb5dbe4756edadc8fbe8c769b0a109493acf7a"
54
+ },
55
+ "seed": 17,
56
+ "dtype": "float32",
57
+ "builder": "example/build_fixtures.py",
58
+ "builder_revision": "d6c4e1368e76b3cb3fbd52f1d7813a1c321195c5",
59
+ "recipe": {
60
+ "seed": 17,
61
+ "model_class": "MT5ForConditionalGeneration"
62
+ },
63
+ "shrink": "rule",
64
+ "model_class": "MT5ForConditionalGeneration",
65
+ "parameters": 16204800,
66
+ "missing_parameters": [],
67
+ "checkpoint_inspection": "parameter headers/indexes; bounded binary fallback",
68
+ "numeric_health_scope": "CPU float32/bfloat16/float16; autocast for low-precision losses",
69
+ "captured": {
70
+ "call": "training step",
71
+ "inputs": [
72
+ "attention_mask",
73
+ "input_ids",
74
+ "labels"
75
+ ],
76
+ "class": "MT5ForConditionalGeneration"
77
+ },
78
+ "weights": "random",
79
+ "gate": {
80
+ "random": {
81
+ "pass": true,
82
+ "accepted_insensitive": {},
83
+ "threshold": 0.001,
84
+ "deltas": {
85
+ "input_ids:roll_batch": 19.915189743041992,
86
+ "input_ids:reverse": 1.8487544059753418,
87
+ "attention_mask:all_ones": null
88
+ },
89
+ "weakest": "input_ids:reverse",
90
+ "no_perturbation_defined": [],
91
+ "not_a_forward_parameter": []
92
+ }
93
+ },
94
+ "numeric_health": {
95
+ "float32": {
96
+ "outputs_finite": true,
97
+ "loss_finite": true,
98
+ "gradients_finite": true,
99
+ "finite": true
100
+ },
101
+ "bfloat16": {
102
+ "outputs_finite": true,
103
+ "loss_finite": true,
104
+ "gradients_finite": true,
105
+ "finite": true
106
+ },
107
+ "float16": {
108
+ "outputs_finite": true,
109
+ "loss_finite": true,
110
+ "unscaled_gradients_finite": true,
111
+ "finite": true
112
+ }
113
+ },
114
+ "copied_unchanged": [
115
+ "generation_config.json",
116
+ "special_tokens_map.json",
117
+ "spiece.model",
118
+ "tokenizer_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": "39542298533a7f1b48c1b792f979d0c9b7e59dea9145761ef456b5b29b6e3d65",
129
+ "generation_config.json": "f5a1c7e2be8092018d8835128987edf0111637dd98e90599cc80310fef75d95a",
130
+ "model.safetensors": "1e3e4034a33fa880a15b89b8b372f3b78091029276e943920ac08f8e8ed0611e",
131
+ "special_tokens_map.json": "cc79702b15102ce1ade7ad5968a83dcedf00ab8a35f9f37867ca00263f7361f1",
132
+ "spiece.model": "ef78f86560d809067d12bac6c09f19a462cb3af3f54d2b8acbba26e1433125d6",
133
+ "tokenizer_config.json": "cc95393d0bb13f2334252ff1869aff6ff15195455b85e214f2f6d1c18237bbfa"
134
+ }
135
+ }
config.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MT5ForConditionalGeneration"
4
+ ],
5
+ "bos_token_id": null,
6
+ "classifier_dropout": 0.0,
7
+ "d_ff": 128,
8
+ "d_kv": 16,
9
+ "d_model": 64,
10
+ "decoder_start_token_id": 0,
11
+ "dense_act_fn": "gelu_new",
12
+ "dropout_rate": 0.1,
13
+ "dtype": "float32",
14
+ "eos_token_id": 1,
15
+ "feed_forward_proj": "gated-gelu",
16
+ "initializer_factor": 1.0,
17
+ "is_decoder": false,
18
+ "is_encoder_decoder": true,
19
+ "is_gated_act": true,
20
+ "layer_norm_epsilon": 1e-06,
21
+ "model_type": "mt5",
22
+ "num_decoder_layers": 2,
23
+ "num_heads": 4,
24
+ "num_layers": 2,
25
+ "pad_token_id": 0,
26
+ "relative_attention_max_distance": 128,
27
+ "relative_attention_num_buckets": 32,
28
+ "tie_word_embeddings": true,
29
+ "tokenizer_class": "T5Tokenizer",
30
+ "transformers_version": "5.22.0.dev0",
31
+ "use_cache": true,
32
+ "vocab_size": 250112
33
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "decoder_start_token_id": 0,
4
+ "eos_token_id": 1,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "4.27.0.dev0"
7
+ }
integration.json ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mic": "0.3",
3
+ "name": "MT5 seq2seq",
4
+ "usage": "AutoTokenizer + AutoModelForSeq2SeqLM, batched translation-style prompts, right padding, inference and one SGD step",
5
+ "architecture": "MT5ForConditionalGeneration",
6
+ "checkpoints": {
7
+ "google/mt5-small": {
8
+ "fixture": "huggingface-mic/mt5-small-mic"
9
+ }
10
+ },
11
+ "fixtures": {
12
+ "huggingface-mic/mt5-small-mic": {
13
+ "built_from": "google/mt5-small",
14
+ "covers": [
15
+ "google/mt5-small"
16
+ ],
17
+ "build": {
18
+ "seed": 17,
19
+ "model_class": "MT5ForConditionalGeneration"
20
+ }
21
+ }
22
+ },
23
+ "integrations": {
24
+ "transformers": {
25
+ "entry_point": "integrations/transformers/usage.md",
26
+ "format": "runnable-markdown",
27
+ "requires": [
28
+ "transformers>=5",
29
+ "torch"
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": 40
49
+ },
50
+ "google/mt5-small": {
51
+ "memory_gb": 4,
52
+ "download_mb": 1200
53
+ }
54
+ }
55
+ }
56
+ },
57
+ "outputs": {
58
+ "runtime": {
59
+ "compare": "exact"
60
+ },
61
+ "decoded_text": {
62
+ "compare": "exact"
63
+ },
64
+ "probe_logits": {
65
+ "compare": "allclose",
66
+ "atol": 0.0001,
67
+ "rtol": 0.0001
68
+ },
69
+ "training.loss": {
70
+ "compare": "allclose",
71
+ "atol": 0.0001,
72
+ "rtol": 0.0001
73
+ },
74
+ "training.gradients": {
75
+ "compare": "all_true"
76
+ },
77
+ "training.updated": {
78
+ "compare": "true"
79
+ }
80
+ }
81
+ }
integrations/transformers/expectations/cpu-x86_64-bf16/mt5-small-mic.bfloat16.json ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/mt5-small-mic",
4
+ "contract_name": "MT5",
5
+ "contract_revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
6
+ "framework": "transformers",
7
+ "variant": "bfloat16",
8
+ "target": "mt5-small-mic",
9
+ "kind": "fixture",
10
+ "revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
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.96,
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
+ "decoded_text": [
44
+ "\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a",
45
+ "Win Win Win Win Win Win Win Win"
46
+ ],
47
+ "probe_logits": [
48
+ [
49
+ 32.0,
50
+ 4.90625,
51
+ 0.56640625,
52
+ 13.125,
53
+ 1.984375
54
+ ],
55
+ [
56
+ 31.25,
57
+ 4.71875,
58
+ 2.28125,
59
+ 12.875,
60
+ -1.2890625
61
+ ]
62
+ ],
63
+ "training": {
64
+ "loss": 42.25,
65
+ "gradients": {
66
+ "encoder.block.0.layer.0.SelfAttention.q.weight": true,
67
+ "decoder.block.0.layer.0.SelfAttention.q.weight": true,
68
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": true
69
+ },
70
+ "updated": true
71
+ }
72
+ }
73
+ }
integrations/transformers/expectations/cpu-x86_64-bf16/mt5-small.bfloat16.json ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/mt5-small-mic",
4
+ "contract_name": "MT5",
5
+ "contract_revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
6
+ "framework": "transformers",
7
+ "variant": "bfloat16",
8
+ "target": "mt5-small",
9
+ "kind": "checkpoint",
10
+ "revision": "73fb5dbe4756edadc8fbe8c769b0a109493acf7a",
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": 8.81,
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
+ "decoded_text": [
44
+ "<extra_id_0>",
45
+ "<extra_id_0>"
46
+ ],
47
+ "probe_logits": [
48
+ [
49
+ -82.0,
50
+ -40.5,
51
+ -80.0,
52
+ -48.25,
53
+ -81.5
54
+ ],
55
+ [
56
+ -82.0,
57
+ -40.0,
58
+ -79.5,
59
+ -48.25,
60
+ -81.5
61
+ ]
62
+ ],
63
+ "training": {
64
+ "loss": 43.5,
65
+ "gradients": {
66
+ "encoder.block.0.layer.0.SelfAttention.q.weight": true,
67
+ "decoder.block.0.layer.0.SelfAttention.q.weight": true,
68
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": true
69
+ },
70
+ "updated": true
71
+ }
72
+ }
73
+ }
integrations/transformers/expectations/cpu-x86_64/mt5-small-mic.eager.json ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/mt5-small-mic",
4
+ "contract_name": "MT5",
5
+ "contract_revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
6
+ "framework": "transformers",
7
+ "variant": "eager",
8
+ "target": "mt5-small-mic",
9
+ "kind": "fixture",
10
+ "revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
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.89,
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
+ "decoded_text": [
44
+ "\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a",
45
+ "Win Win Win Win Win Win Win Win"
46
+ ],
47
+ "probe_logits": [
48
+ [
49
+ 31.924089431762695,
50
+ 4.906943321228027,
51
+ 0.616293728351593,
52
+ 13.151477813720703,
53
+ 2.058328866958618
54
+ ],
55
+ [
56
+ 31.29679298400879,
57
+ 4.671817302703857,
58
+ 2.257627248764038,
59
+ 12.908455848693848,
60
+ -1.2190288305282593
61
+ ]
62
+ ],
63
+ "training": {
64
+ "loss": 41.97232437133789,
65
+ "gradients": {
66
+ "encoder.block.0.layer.0.SelfAttention.q.weight": true,
67
+ "decoder.block.0.layer.0.SelfAttention.q.weight": true,
68
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": true
69
+ },
70
+ "updated": true
71
+ }
72
+ }
73
+ }
integrations/transformers/expectations/cpu-x86_64/mt5-small-mic.json ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/mt5-small-mic",
4
+ "contract_name": "MT5",
5
+ "contract_revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
6
+ "framework": "transformers",
7
+ "variant": "default",
8
+ "target": "mt5-small-mic",
9
+ "kind": "fixture",
10
+ "revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
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.9,
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
+ "decoded_text": [
44
+ "\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a",
45
+ "Win Win Win Win Win Win Win Win"
46
+ ],
47
+ "probe_logits": [
48
+ [
49
+ 31.92408561706543,
50
+ 4.906943321228027,
51
+ 0.6162940859794617,
52
+ 13.15147590637207,
53
+ 2.058326482772827
54
+ ],
55
+ [
56
+ 31.296785354614258,
57
+ 4.671821594238281,
58
+ 2.2576253414154053,
59
+ 12.908452987670898,
60
+ -1.2190295457839966
61
+ ]
62
+ ],
63
+ "training": {
64
+ "loss": 41.97232437133789,
65
+ "gradients": {
66
+ "encoder.block.0.layer.0.SelfAttention.q.weight": true,
67
+ "decoder.block.0.layer.0.SelfAttention.q.weight": true,
68
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": true
69
+ },
70
+ "updated": true
71
+ }
72
+ }
73
+ }
integrations/transformers/expectations/cpu-x86_64/mt5-small.eager.json ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/mt5-small-mic",
4
+ "contract_name": "MT5",
5
+ "contract_revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
6
+ "framework": "transformers",
7
+ "variant": "eager",
8
+ "target": "mt5-small",
9
+ "kind": "checkpoint",
10
+ "revision": "73fb5dbe4756edadc8fbe8c769b0a109493acf7a",
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": 9.72,
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
+ "decoded_text": [
44
+ "<extra_id_0>",
45
+ "<extra_id_0>"
46
+ ],
47
+ "probe_logits": [
48
+ [
49
+ -83.30730438232422,
50
+ -40.77534103393555,
51
+ -80.95649719238281,
52
+ -48.83641815185547,
53
+ -82.65409851074219
54
+ ],
55
+ [
56
+ -83.26654052734375,
57
+ -40.62522506713867,
58
+ -80.89242553710938,
59
+ -48.791778564453125,
60
+ -82.61404418945312
61
+ ]
62
+ ],
63
+ "training": {
64
+ "loss": 41.73249435424805,
65
+ "gradients": {
66
+ "encoder.block.0.layer.0.SelfAttention.q.weight": true,
67
+ "decoder.block.0.layer.0.SelfAttention.q.weight": true,
68
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": true
69
+ },
70
+ "updated": true
71
+ }
72
+ }
73
+ }
integrations/transformers/expectations/cpu-x86_64/mt5-small.json ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/mt5-small-mic",
4
+ "contract_name": "MT5",
5
+ "contract_revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
6
+ "framework": "transformers",
7
+ "variant": "default",
8
+ "target": "mt5-small",
9
+ "kind": "checkpoint",
10
+ "revision": "73fb5dbe4756edadc8fbe8c769b0a109493acf7a",
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": 9.5,
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
+ "decoded_text": [
44
+ "<extra_id_0>",
45
+ "<extra_id_0>"
46
+ ],
47
+ "probe_logits": [
48
+ [
49
+ -83.30732727050781,
50
+ -40.77533721923828,
51
+ -80.95652770996094,
52
+ -48.836429595947266,
53
+ -82.65412139892578
54
+ ],
55
+ [
56
+ -83.2664794921875,
57
+ -40.625205993652344,
58
+ -80.89237976074219,
59
+ -48.7917594909668,
60
+ -82.61398315429688
61
+ ]
62
+ ],
63
+ "training": {
64
+ "loss": 41.73249435424805,
65
+ "gradients": {
66
+ "encoder.block.0.layer.0.SelfAttention.q.weight": true,
67
+ "decoder.block.0.layer.0.SelfAttention.q.weight": true,
68
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": true
69
+ },
70
+ "updated": true
71
+ }
72
+ }
73
+ }
integrations/transformers/expectations/cuda/mt5-small-mic.bfloat16.json ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/mt5-small-mic",
4
+ "contract_name": "MT5",
5
+ "contract_revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
6
+ "framework": "transformers",
7
+ "variant": "bfloat16",
8
+ "target": "mt5-small-mic",
9
+ "kind": "fixture",
10
+ "revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
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": 8.69,
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
+ "decoded_text": [
45
+ "\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a",
46
+ "Win Win Win Win Win Win Win Win"
47
+ ],
48
+ "probe_logits": [
49
+ [
50
+ 32.0,
51
+ 4.90625,
52
+ 0.56640625,
53
+ 13.125,
54
+ 1.984375
55
+ ],
56
+ [
57
+ 31.25,
58
+ 4.71875,
59
+ 2.28125,
60
+ 12.875,
61
+ -1.2890625
62
+ ]
63
+ ],
64
+ "training": {
65
+ "loss": 40.0,
66
+ "gradients": {
67
+ "encoder.block.0.layer.0.SelfAttention.q.weight": true,
68
+ "decoder.block.0.layer.0.SelfAttention.q.weight": true,
69
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": true
70
+ },
71
+ "updated": true
72
+ }
73
+ }
74
+ }
integrations/transformers/expectations/cuda/mt5-small-mic.eager.json ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/mt5-small-mic",
4
+ "contract_name": "MT5",
5
+ "contract_revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
6
+ "framework": "transformers",
7
+ "variant": "eager",
8
+ "target": "mt5-small-mic",
9
+ "kind": "fixture",
10
+ "revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
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": 8.42,
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
+ "decoded_text": [
45
+ "\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a",
46
+ "Win Win Win Win Win Win Win Win"
47
+ ],
48
+ "probe_logits": [
49
+ [
50
+ 31.92409324645996,
51
+ 4.906939506530762,
52
+ 0.6162940859794617,
53
+ 13.151477813720703,
54
+ 2.0583276748657227
55
+ ],
56
+ [
57
+ 31.296794891357422,
58
+ 4.671820640563965,
59
+ 2.2576253414154053,
60
+ 12.908452987670898,
61
+ -1.2190306186676025
62
+ ]
63
+ ],
64
+ "training": {
65
+ "loss": 39.740699768066406,
66
+ "gradients": {
67
+ "encoder.block.0.layer.0.SelfAttention.q.weight": true,
68
+ "decoder.block.0.layer.0.SelfAttention.q.weight": true,
69
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": true
70
+ },
71
+ "updated": true
72
+ }
73
+ }
74
+ }
integrations/transformers/expectations/cuda/mt5-small-mic.json ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/mt5-small-mic",
4
+ "contract_name": "MT5",
5
+ "contract_revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
6
+ "framework": "transformers",
7
+ "variant": "default",
8
+ "target": "mt5-small-mic",
9
+ "kind": "fixture",
10
+ "revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
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": 9.48,
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
+ "decoded_text": [
45
+ "\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a\u0e01\u0e23\u0e2d\u0e1a",
46
+ "Win Win Win Win Win Win Win Win"
47
+ ],
48
+ "probe_logits": [
49
+ [
50
+ 31.924089431762695,
51
+ 4.9069414138793945,
52
+ 0.6162965297698975,
53
+ 13.15147876739502,
54
+ 2.0583250522613525
55
+ ],
56
+ [
57
+ 31.296791076660156,
58
+ 4.671821594238281,
59
+ 2.257628917694092,
60
+ 12.908448219299316,
61
+ -1.219033122062683
62
+ ]
63
+ ],
64
+ "training": {
65
+ "loss": 41.73788070678711,
66
+ "gradients": {
67
+ "encoder.block.0.layer.0.SelfAttention.q.weight": true,
68
+ "decoder.block.0.layer.0.SelfAttention.q.weight": true,
69
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": true
70
+ },
71
+ "updated": true
72
+ }
73
+ }
74
+ }
integrations/transformers/expectations/cuda/mt5-small.bfloat16.json ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/mt5-small-mic",
4
+ "contract_name": "MT5",
5
+ "contract_revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
6
+ "framework": "transformers",
7
+ "variant": "bfloat16",
8
+ "target": "mt5-small",
9
+ "kind": "checkpoint",
10
+ "revision": "73fb5dbe4756edadc8fbe8c769b0a109493acf7a",
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": 10.16,
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
+ "decoded_text": [
45
+ "<extra_id_0>",
46
+ "<extra_id_0>"
47
+ ],
48
+ "probe_logits": [
49
+ [
50
+ -83.0,
51
+ -40.5,
52
+ -80.5,
53
+ -48.5,
54
+ -82.0
55
+ ],
56
+ [
57
+ -82.0,
58
+ -40.25,
59
+ -79.5,
60
+ -48.25,
61
+ -81.5
62
+ ]
63
+ ],
64
+ "training": {
65
+ "loss": 14.4375,
66
+ "gradients": {
67
+ "encoder.block.0.layer.0.SelfAttention.q.weight": true,
68
+ "decoder.block.0.layer.0.SelfAttention.q.weight": true,
69
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": true
70
+ },
71
+ "updated": true
72
+ }
73
+ }
74
+ }
integrations/transformers/expectations/cuda/mt5-small.eager.json ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/mt5-small-mic",
4
+ "contract_name": "MT5",
5
+ "contract_revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
6
+ "framework": "transformers",
7
+ "variant": "eager",
8
+ "target": "mt5-small",
9
+ "kind": "checkpoint",
10
+ "revision": "73fb5dbe4756edadc8fbe8c769b0a109493acf7a",
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": 10.18,
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
+ "decoded_text": [
45
+ "<extra_id_0>",
46
+ "<extra_id_0>"
47
+ ],
48
+ "probe_logits": [
49
+ [
50
+ -83.30729675292969,
51
+ -40.77532196044922,
52
+ -80.95647430419922,
53
+ -48.83641815185547,
54
+ -82.6540756225586
55
+ ],
56
+ [
57
+ -83.26657104492188,
58
+ -40.62522506713867,
59
+ -80.89244842529297,
60
+ -48.79179763793945,
61
+ -82.61406707763672
62
+ ]
63
+ ],
64
+ "training": {
65
+ "loss": 22.291109085083008,
66
+ "gradients": {
67
+ "encoder.block.0.layer.0.SelfAttention.q.weight": true,
68
+ "decoder.block.0.layer.0.SelfAttention.q.weight": true,
69
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": true
70
+ },
71
+ "updated": true
72
+ }
73
+ }
74
+ }
integrations/transformers/expectations/cuda/mt5-small.json ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/mt5-small-mic",
4
+ "contract_name": "MT5",
5
+ "contract_revision": "9ff934117e671a6149ff14e52b379bc79286d5f6",
6
+ "framework": "transformers",
7
+ "variant": "default",
8
+ "target": "mt5-small",
9
+ "kind": "checkpoint",
10
+ "revision": "73fb5dbe4756edadc8fbe8c769b0a109493acf7a",
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": 10.75,
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
+ "decoded_text": [
45
+ "<extra_id_0>",
46
+ "<extra_id_0>"
47
+ ],
48
+ "probe_logits": [
49
+ [
50
+ -83.30731201171875,
51
+ -40.775333404541016,
52
+ -80.95648956298828,
53
+ -48.836429595947266,
54
+ -82.65409088134766
55
+ ],
56
+ [
57
+ -83.26655578613281,
58
+ -40.62522506713867,
59
+ -80.8924331665039,
60
+ -48.79179763793945,
61
+ -82.61405944824219
62
+ ]
63
+ ],
64
+ "training": {
65
+ "loss": 15.268765449523926,
66
+ "gradients": {
67
+ "encoder.block.0.layer.0.SelfAttention.q.weight": true,
68
+ "decoder.block.0.layer.0.SelfAttention.q.weight": true,
69
+ "decoder.block.0.layer.1.EncDecAttention.q.weight": true
70
+ },
71
+ "updated": true
72
+ }
73
+ }
74
+ }
integrations/transformers/usage.md ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MT5: seq2seq generation with Transformers
2
+
3
+ This page is the Transformers contract of the MT5 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 `google/mt5-small`. The MIC runner runs the same blocks against each slim fixture and each 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
+ ## Translate a batch
6
+
7
+ ```py runnable:mt5
8
+ import torch
9
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, set_seed
10
+ import json # doc-builder: hide
11
+ import os # doc-builder: hide
12
+
13
+ model_id = "google/mt5-small"
14
+ model_id = os.environ.get("MIC_MODEL", model_id) # doc-builder: hide
15
+ variant = json.loads(os.environ.get("MIC_MODEL_KWARGS", "{}")) # doc-builder: hide
16
+ device = "cuda" if torch.cuda.is_available() else "cpu"
17
+ set_seed(0) # seeds torch, NumPy, and Python: loading, dropout, and generation draw random numbers
18
+
19
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
20
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_id).to(device)
21
+ if variant: # doc-builder: hide
22
+ del model # doc-builder: hide
23
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_id, **variant).to(device) # doc-builder: hide
24
+
25
+ # MT5 is multilingual; the "translate English to German:" prefix selects the task.
26
+ prompts = [
27
+ "translate English to German: The house is wonderful.",
28
+ "translate English to German: I like to read books.",
29
+ ]
30
+ inputs = tokenizer(prompts, return_tensors="pt", padding=True).to(device)
31
+
32
+ model.eval()
33
+ with torch.no_grad():
34
+ generated = model.generate(**inputs, max_new_tokens=8)
35
+ logits = model(**inputs, decoder_input_ids=generated).logits
36
+
37
+ decoded = tokenizer.batch_decode(generated, skip_special_tokens=True)
38
+ print(decoded)
39
+
40
+ # Probe a few logits at the first generated position of each sequence.
41
+ probe = logits[:, 0, :5].float().tolist()
42
+ ```
43
+
44
+ ## One training step
45
+
46
+ ```py runnable:mt5:2
47
+ # Teacher forcing: the labels are the tokenized German references.
48
+ references = ["Das Haus ist wunderbar.", "Ich lese gerne Bücher."]
49
+ labels = tokenizer(references, return_tensors="pt", padding=True).to(device)["input_ids"]
50
+ labels[labels == tokenizer.pad_token_id] = -100
51
+
52
+ model.train()
53
+ optimizer = torch.optim.SGD([p for p in model.parameters() if p.requires_grad], lr=0.01)
54
+ loss = model(**inputs, labels=labels).loss
55
+ loss.backward()
56
+ before = {n: p.detach().cpu().clone() for n, p in model.named_parameters() if p.requires_grad} # doc-builder: hide
57
+ optimizer.step()
58
+ print(f"loss: {loss.item():.4f}")
59
+
60
+ if os.environ.get("MIC_RUNNER"): # doc-builder: hide
61
+ named = dict(model.named_parameters())
62
+ checked = (
63
+ "encoder.block.0.layer.0.SelfAttention.q.weight",
64
+ "decoder.block.0.layer.0.SelfAttention.q.weight",
65
+ "decoder.block.0.layer.1.EncDecAttention.q.weight",
66
+ )
67
+ result = {
68
+ "runtime": {
69
+ "device": model.device.type,
70
+ "dtype": str(model.dtype).removeprefix("torch."),
71
+ "attn_implementation": model.config._attn_implementation,
72
+ },
73
+ "decoded_text": decoded,
74
+ "probe_logits": probe,
75
+ "training": {
76
+ "loss": loss.item(),
77
+ "gradients": {
78
+ n: bool(
79
+ named[n].grad is not None
80
+ and torch.count_nonzero(named[n].grad) > 0
81
+ and torch.isfinite(named[n].grad).all()
82
+ )
83
+ for n in checked
84
+ },
85
+ "updated": any(
86
+ not torch.equal(p.detach().cpu(), before[n])
87
+ for n, p in model.named_parameters()
88
+ if n in before
89
+ ),
90
+ },
91
+ }
92
+ print(json.dumps(result))
93
+ ```
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e3e4034a33fa880a15b89b8b372f3b78091029276e943920ac08f8e8ed0611e
3
+ size 64824904
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"eos_token": "</s>", "unk_token": "<unk>", "pad_token": "<pad>", "additional_special_tokens": []}
spiece.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef78f86560d809067d12bac6c09f19a462cb3af3f54d2b8acbba26e1433125d6
3
+ size 4309802
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"eos_token": "</s>", "unk_token": "<unk>", "pad_token": "<pad>", "extra_ids": 0}