[PoC B] Input cases as variant-like runs (one run per case, every case for every variant)

#6
by hf-transformers-bot HF Staff - opened
integration.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "mic": "0.3",
3
  "name": "Gemma3 causal LM",
4
- "usage": "AutoProcessor + AutoModelForCausalLM, text-only batched with padding, one training step",
5
  "architecture": "Gemma3ForConditionalGeneration",
6
  "checkpoints": {
7
  "google/gemma-3-4b-it": {
@@ -39,6 +39,11 @@
39
  "dtype": "bfloat16"
40
  }
41
  },
 
 
 
 
 
42
  "training": true,
43
  "resources": {
44
  "fixture": {
 
1
  {
2
  "mic": "0.3",
3
  "name": "Gemma3 causal LM",
4
+ "usage": "AutoProcessor + AutoModelForCausalLM, one run per input case (text batched with padding, image, text + image), one training step",
5
  "architecture": "Gemma3ForConditionalGeneration",
6
  "checkpoints": {
7
  "google/gemma-3-4b-it": {
 
39
  "dtype": "bfloat16"
40
  }
41
  },
42
+ "cases": {
43
+ "text": {},
44
+ "image": {},
45
+ "text_image": {}
46
+ },
47
  "training": true,
48
  "resources": {
49
  "fixture": {
integrations/transformers/expectations/cuda/gemma3-mic.bfloat16.image.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/gemma3-mic",
4
+ "contract_name": "mic-gemma3",
5
+ "contract_revision": "unpublished",
6
+ "framework": "transformers",
7
+ "variant": "bfloat16",
8
+ "target": "gemma3-mic",
9
+ "kind": "fixture",
10
+ "revision": "7987697a4ca53c8cb7217b7f82c891cf5e6ad09a",
11
+ "source_model": "google/gemma-3-4b-it",
12
+ "weights": "random",
13
+ "fixture_repo": "huggingface-mic/gemma3-mic",
14
+ "environment": {
15
+ "python": "3.11.18",
16
+ "transformers": "5.24.0.dev0",
17
+ "sentence-transformers": null,
18
+ "torch": "2.15.0",
19
+ "torchvision": "0.29.2",
20
+ "torchaudio": "2.11.1",
21
+ "tokenizers": "0.23.3",
22
+ "numpy": "2.3.5",
23
+ "pillow": "13.0.0",
24
+ "accelerate": "1.16.0",
25
+ "safetensors": "0.8.0",
26
+ "huggingface-hub": "2.4.0",
27
+ "sentencepiece": "0.2.3",
28
+ "protobuf": "7.36.2",
29
+ "librosa": "0.11.0",
30
+ "soundfile": "0.14.0",
31
+ "scipy": "1.17.1"
32
+ },
33
+ "seconds": 6.43,
34
+ "environment_differs": {
35
+ "pillow": "13.0.0 (pinned 12.3.0)",
36
+ "accelerate": "1.16.0 (pinned 1.15.0)",
37
+ "huggingface-hub": "2.4.0 (pinned 2.3.0)",
38
+ "sentencepiece": "0.2.3 (pinned 0.2.2)"
39
+ },
40
+ "platform": "cuda",
41
+ "baseline_repo": "huggingface-mic/gemma3-mic",
42
+ "baseline_revision": "unpublished",
43
+ "baseline_path": "integrations/transformers/expectations/cuda/gemma3-mic.bfloat16.json",
44
+ "template_date": "2026-01-01"
45
+ },
46
+ "outputs": {
47
+ "runtime": {
48
+ "device": "cuda",
49
+ "dtype": "bfloat16",
50
+ "attn_implementation": "sdpa",
51
+ "attn_implementations": {
52
+ "text_config": "sdpa",
53
+ "vision_config": "sdpa"
54
+ }
55
+ },
56
+ "predicted_tokens": [
57
+ "\u10d4\u10d1\u10e3\u10da\u10d8\u10d0"
58
+ ],
59
+ "predicted_text": "\u10d4\u10d1\u10e3\u10da\u10d8\u10d0",
60
+ "answer_logits": [
61
+ [
62
+ 0.70703125,
63
+ 0.703125,
64
+ 0.69921875
65
+ ]
66
+ ],
67
+ "training": {
68
+ "loss": 12.493996620178223,
69
+ "gradients": {
70
+ "model.multi_modal_projector.mm_input_projection_weight": true,
71
+ "model.language_model.embed_tokens.weight": true
72
+ },
73
+ "updated": true
74
+ }
75
+ }
76
+ }
integrations/transformers/expectations/cuda/gemma3-mic.bfloat16.text.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/gemma3-mic",
4
+ "contract_name": "mic-gemma3",
5
+ "contract_revision": "unpublished",
6
+ "framework": "transformers",
7
+ "variant": "bfloat16",
8
+ "target": "gemma3-mic",
9
+ "kind": "fixture",
10
+ "revision": "7987697a4ca53c8cb7217b7f82c891cf5e6ad09a",
11
+ "source_model": "google/gemma-3-4b-it",
12
+ "weights": "random",
13
+ "fixture_repo": "huggingface-mic/gemma3-mic",
14
+ "environment": {
15
+ "python": "3.11.18",
16
+ "transformers": "5.24.0.dev0",
17
+ "sentence-transformers": null,
18
+ "torch": "2.15.0",
19
+ "torchvision": "0.29.2",
20
+ "torchaudio": "2.11.1",
21
+ "tokenizers": "0.23.3",
22
+ "numpy": "2.3.5",
23
+ "pillow": "13.0.0",
24
+ "accelerate": "1.16.0",
25
+ "safetensors": "0.8.0",
26
+ "huggingface-hub": "2.4.0",
27
+ "sentencepiece": "0.2.3",
28
+ "protobuf": "7.36.2",
29
+ "librosa": "0.11.0",
30
+ "soundfile": "0.14.0",
31
+ "scipy": "1.17.1"
32
+ },
33
+ "seconds": 6.12,
34
+ "environment_differs": {
35
+ "pillow": "13.0.0 (pinned 12.3.0)",
36
+ "accelerate": "1.16.0 (pinned 1.15.0)",
37
+ "huggingface-hub": "2.4.0 (pinned 2.3.0)",
38
+ "sentencepiece": "0.2.3 (pinned 0.2.2)"
39
+ },
40
+ "platform": "cuda",
41
+ "baseline_repo": "huggingface-mic/gemma3-mic",
42
+ "baseline_revision": "unpublished",
43
+ "baseline_path": "integrations/transformers/expectations/cuda/gemma3-mic.bfloat16.json",
44
+ "template_date": "2026-01-01"
45
+ },
46
+ "outputs": {
47
+ "runtime": {
48
+ "device": "cuda",
49
+ "dtype": "bfloat16",
50
+ "attn_implementation": "sdpa",
51
+ "attn_implementations": {
52
+ "text_config": "sdpa",
53
+ "vision_config": "sdpa"
54
+ }
55
+ },
56
+ "predicted_tokens": [
57
+ "\u2581\u0987\u09a8\u09cd\u09a6\u09c1",
58
+ "\u0648\u0627\u062c"
59
+ ],
60
+ "predicted_text": " \u0987\u09a8\u09cd\u09a6\u09c1\u0648\u0627\u062c",
61
+ "answer_logits": [
62
+ [
63
+ 0.6796875,
64
+ 0.66796875,
65
+ 0.6640625
66
+ ],
67
+ [
68
+ 0.71875,
69
+ 0.66015625,
70
+ 0.65625
71
+ ]
72
+ ],
73
+ "training": {
74
+ "loss": 12.520472526550293,
75
+ "gradients": {
76
+ "model.language_model.embed_tokens.weight": true,
77
+ "model.language_model.layers.0.self_attn.q_proj.weight": true
78
+ },
79
+ "updated": true
80
+ }
81
+ }
82
+ }
integrations/transformers/expectations/cuda/gemma3-mic.bfloat16.text_image.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/gemma3-mic",
4
+ "contract_name": "mic-gemma3",
5
+ "contract_revision": "unpublished",
6
+ "framework": "transformers",
7
+ "variant": "bfloat16",
8
+ "target": "gemma3-mic",
9
+ "kind": "fixture",
10
+ "revision": "7987697a4ca53c8cb7217b7f82c891cf5e6ad09a",
11
+ "source_model": "google/gemma-3-4b-it",
12
+ "weights": "random",
13
+ "fixture_repo": "huggingface-mic/gemma3-mic",
14
+ "environment": {
15
+ "python": "3.11.18",
16
+ "transformers": "5.24.0.dev0",
17
+ "sentence-transformers": null,
18
+ "torch": "2.15.0",
19
+ "torchvision": "0.29.2",
20
+ "torchaudio": "2.11.1",
21
+ "tokenizers": "0.23.3",
22
+ "numpy": "2.3.5",
23
+ "pillow": "13.0.0",
24
+ "accelerate": "1.16.0",
25
+ "safetensors": "0.8.0",
26
+ "huggingface-hub": "2.4.0",
27
+ "sentencepiece": "0.2.3",
28
+ "protobuf": "7.36.2",
29
+ "librosa": "0.11.0",
30
+ "soundfile": "0.14.0",
31
+ "scipy": "1.17.1"
32
+ },
33
+ "seconds": 6.71,
34
+ "environment_differs": {
35
+ "pillow": "13.0.0 (pinned 12.3.0)",
36
+ "accelerate": "1.16.0 (pinned 1.15.0)",
37
+ "huggingface-hub": "2.4.0 (pinned 2.3.0)",
38
+ "sentencepiece": "0.2.3 (pinned 0.2.2)"
39
+ },
40
+ "platform": "cuda",
41
+ "baseline_repo": "huggingface-mic/gemma3-mic",
42
+ "baseline_revision": "unpublished",
43
+ "baseline_path": "integrations/transformers/expectations/cuda/gemma3-mic.bfloat16.json",
44
+ "template_date": "2026-01-01"
45
+ },
46
+ "outputs": {
47
+ "runtime": {
48
+ "device": "cuda",
49
+ "dtype": "bfloat16",
50
+ "attn_implementation": "sdpa",
51
+ "attn_implementations": {
52
+ "text_config": "sdpa",
53
+ "vision_config": "sdpa"
54
+ }
55
+ },
56
+ "predicted_tokens": [
57
+ "\u10d4\u10d1\u10e3\u10da\u10d8\u10d0"
58
+ ],
59
+ "predicted_text": "\u10d4\u10d1\u10e3\u10da\u10d8\u10d0",
60
+ "answer_logits": [
61
+ [
62
+ 0.84765625,
63
+ 0.765625,
64
+ 0.66796875
65
+ ]
66
+ ],
67
+ "training": {
68
+ "loss": 12.493707656860352,
69
+ "gradients": {
70
+ "model.multi_modal_projector.mm_input_projection_weight": true,
71
+ "model.language_model.embed_tokens.weight": true
72
+ },
73
+ "updated": true
74
+ }
75
+ }
76
+ }
integrations/transformers/expectations/cuda/gemma3-mic.eager.image.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/gemma3-mic",
4
+ "contract_name": "mic-gemma3",
5
+ "contract_revision": "unpublished",
6
+ "framework": "transformers",
7
+ "variant": "eager",
8
+ "target": "gemma3-mic",
9
+ "kind": "fixture",
10
+ "revision": "7987697a4ca53c8cb7217b7f82c891cf5e6ad09a",
11
+ "source_model": "google/gemma-3-4b-it",
12
+ "weights": "random",
13
+ "fixture_repo": "huggingface-mic/gemma3-mic",
14
+ "environment": {
15
+ "python": "3.11.18",
16
+ "transformers": "5.24.0.dev0",
17
+ "sentence-transformers": null,
18
+ "torch": "2.15.0",
19
+ "torchvision": "0.29.2",
20
+ "torchaudio": "2.11.1",
21
+ "tokenizers": "0.23.3",
22
+ "numpy": "2.3.5",
23
+ "pillow": "13.0.0",
24
+ "accelerate": "1.16.0",
25
+ "safetensors": "0.8.0",
26
+ "huggingface-hub": "2.4.0",
27
+ "sentencepiece": "0.2.3",
28
+ "protobuf": "7.36.2",
29
+ "librosa": "0.11.0",
30
+ "soundfile": "0.14.0",
31
+ "scipy": "1.17.1"
32
+ },
33
+ "seconds": 6.68,
34
+ "environment_differs": {
35
+ "pillow": "13.0.0 (pinned 12.3.0)",
36
+ "accelerate": "1.16.0 (pinned 1.15.0)",
37
+ "huggingface-hub": "2.4.0 (pinned 2.3.0)",
38
+ "sentencepiece": "0.2.3 (pinned 0.2.2)"
39
+ },
40
+ "platform": "cuda",
41
+ "baseline_repo": "huggingface-mic/gemma3-mic",
42
+ "baseline_revision": "unpublished",
43
+ "baseline_path": "integrations/transformers/expectations/cuda/gemma3-mic.eager.json",
44
+ "template_date": "2026-01-01"
45
+ },
46
+ "outputs": {
47
+ "runtime": {
48
+ "device": "cuda",
49
+ "dtype": "bfloat16",
50
+ "attn_implementation": "eager",
51
+ "attn_implementations": {
52
+ "text_config": "eager",
53
+ "vision_config": "eager"
54
+ }
55
+ },
56
+ "predicted_tokens": [
57
+ "\u10d4\u10d1\u10e3\u10da\u10d8\u10d0"
58
+ ],
59
+ "predicted_text": "\u10d4\u10d1\u10e3\u10da\u10d8\u10d0",
60
+ "answer_logits": [
61
+ [
62
+ 0.70703125,
63
+ 0.703125,
64
+ 0.69921875
65
+ ]
66
+ ],
67
+ "training": {
68
+ "loss": 12.494494438171387,
69
+ "gradients": {
70
+ "model.multi_modal_projector.mm_input_projection_weight": true,
71
+ "model.language_model.embed_tokens.weight": true
72
+ },
73
+ "updated": true
74
+ }
75
+ }
76
+ }
integrations/transformers/expectations/cuda/gemma3-mic.eager.text.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/gemma3-mic",
4
+ "contract_name": "mic-gemma3",
5
+ "contract_revision": "unpublished",
6
+ "framework": "transformers",
7
+ "variant": "eager",
8
+ "target": "gemma3-mic",
9
+ "kind": "fixture",
10
+ "revision": "7987697a4ca53c8cb7217b7f82c891cf5e6ad09a",
11
+ "source_model": "google/gemma-3-4b-it",
12
+ "weights": "random",
13
+ "fixture_repo": "huggingface-mic/gemma3-mic",
14
+ "environment": {
15
+ "python": "3.11.18",
16
+ "transformers": "5.24.0.dev0",
17
+ "sentence-transformers": null,
18
+ "torch": "2.15.0",
19
+ "torchvision": "0.29.2",
20
+ "torchaudio": "2.11.1",
21
+ "tokenizers": "0.23.3",
22
+ "numpy": "2.3.5",
23
+ "pillow": "13.0.0",
24
+ "accelerate": "1.16.0",
25
+ "safetensors": "0.8.0",
26
+ "huggingface-hub": "2.4.0",
27
+ "sentencepiece": "0.2.3",
28
+ "protobuf": "7.36.2",
29
+ "librosa": "0.11.0",
30
+ "soundfile": "0.14.0",
31
+ "scipy": "1.17.1"
32
+ },
33
+ "seconds": 6.72,
34
+ "environment_differs": {
35
+ "pillow": "13.0.0 (pinned 12.3.0)",
36
+ "accelerate": "1.16.0 (pinned 1.15.0)",
37
+ "huggingface-hub": "2.4.0 (pinned 2.3.0)",
38
+ "sentencepiece": "0.2.3 (pinned 0.2.2)"
39
+ },
40
+ "platform": "cuda",
41
+ "baseline_repo": "huggingface-mic/gemma3-mic",
42
+ "baseline_revision": "unpublished",
43
+ "baseline_path": "integrations/transformers/expectations/cuda/gemma3-mic.eager.json",
44
+ "template_date": "2026-01-01"
45
+ },
46
+ "outputs": {
47
+ "runtime": {
48
+ "device": "cuda",
49
+ "dtype": "bfloat16",
50
+ "attn_implementation": "eager",
51
+ "attn_implementations": {
52
+ "text_config": "eager",
53
+ "vision_config": "eager"
54
+ }
55
+ },
56
+ "predicted_tokens": [
57
+ "\u2581\u0987\u09a8\u09cd\u09a6\u09c1",
58
+ "\u0648\u0627\u062c"
59
+ ],
60
+ "predicted_text": " \u0987\u09a8\u09cd\u09a6\u09c1\u0648\u0627\u062c",
61
+ "answer_logits": [
62
+ [
63
+ 0.67578125,
64
+ 0.66796875,
65
+ 0.66796875
66
+ ],
67
+ [
68
+ 0.71875,
69
+ 0.66015625,
70
+ 0.66015625
71
+ ]
72
+ ],
73
+ "training": {
74
+ "loss": 12.525347709655762,
75
+ "gradients": {
76
+ "model.language_model.embed_tokens.weight": true,
77
+ "model.language_model.layers.0.self_attn.q_proj.weight": true
78
+ },
79
+ "updated": true
80
+ }
81
+ }
82
+ }
integrations/transformers/expectations/cuda/gemma3-mic.eager.text_image.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/gemma3-mic",
4
+ "contract_name": "mic-gemma3",
5
+ "contract_revision": "unpublished",
6
+ "framework": "transformers",
7
+ "variant": "eager",
8
+ "target": "gemma3-mic",
9
+ "kind": "fixture",
10
+ "revision": "7987697a4ca53c8cb7217b7f82c891cf5e6ad09a",
11
+ "source_model": "google/gemma-3-4b-it",
12
+ "weights": "random",
13
+ "fixture_repo": "huggingface-mic/gemma3-mic",
14
+ "environment": {
15
+ "python": "3.11.18",
16
+ "transformers": "5.24.0.dev0",
17
+ "sentence-transformers": null,
18
+ "torch": "2.15.0",
19
+ "torchvision": "0.29.2",
20
+ "torchaudio": "2.11.1",
21
+ "tokenizers": "0.23.3",
22
+ "numpy": "2.3.5",
23
+ "pillow": "13.0.0",
24
+ "accelerate": "1.16.0",
25
+ "safetensors": "0.8.0",
26
+ "huggingface-hub": "2.4.0",
27
+ "sentencepiece": "0.2.3",
28
+ "protobuf": "7.36.2",
29
+ "librosa": "0.11.0",
30
+ "soundfile": "0.14.0",
31
+ "scipy": "1.17.1"
32
+ },
33
+ "seconds": 6.91,
34
+ "environment_differs": {
35
+ "pillow": "13.0.0 (pinned 12.3.0)",
36
+ "accelerate": "1.16.0 (pinned 1.15.0)",
37
+ "huggingface-hub": "2.4.0 (pinned 2.3.0)",
38
+ "sentencepiece": "0.2.3 (pinned 0.2.2)"
39
+ },
40
+ "platform": "cuda",
41
+ "baseline_repo": "huggingface-mic/gemma3-mic",
42
+ "baseline_revision": "unpublished",
43
+ "baseline_path": "integrations/transformers/expectations/cuda/gemma3-mic.eager.json",
44
+ "template_date": "2026-01-01"
45
+ },
46
+ "outputs": {
47
+ "runtime": {
48
+ "device": "cuda",
49
+ "dtype": "bfloat16",
50
+ "attn_implementation": "eager",
51
+ "attn_implementations": {
52
+ "text_config": "eager",
53
+ "vision_config": "eager"
54
+ }
55
+ },
56
+ "predicted_tokens": [
57
+ "\u10d4\u10d1\u10e3\u10da\u10d8\u10d0"
58
+ ],
59
+ "predicted_text": "\u10d4\u10d1\u10e3\u10da\u10d8\u10d0",
60
+ "answer_logits": [
61
+ [
62
+ 0.84375,
63
+ 0.76171875,
64
+ 0.671875
65
+ ]
66
+ ],
67
+ "training": {
68
+ "loss": 12.494178771972656,
69
+ "gradients": {
70
+ "model.multi_modal_projector.mm_input_projection_weight": true,
71
+ "model.language_model.embed_tokens.weight": true
72
+ },
73
+ "updated": true
74
+ }
75
+ }
76
+ }
integrations/transformers/expectations/cuda/gemma3-mic.image.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/gemma3-mic",
4
+ "contract_name": "mic-gemma3",
5
+ "contract_revision": "unpublished",
6
+ "framework": "transformers",
7
+ "variant": "default",
8
+ "target": "gemma3-mic",
9
+ "kind": "fixture",
10
+ "revision": "7987697a4ca53c8cb7217b7f82c891cf5e6ad09a",
11
+ "source_model": "google/gemma-3-4b-it",
12
+ "weights": "random",
13
+ "fixture_repo": "huggingface-mic/gemma3-mic",
14
+ "environment": {
15
+ "python": "3.11.18",
16
+ "transformers": "5.24.0.dev0",
17
+ "sentence-transformers": null,
18
+ "torch": "2.15.0",
19
+ "torchvision": "0.29.2",
20
+ "torchaudio": "2.11.1",
21
+ "tokenizers": "0.23.3",
22
+ "numpy": "2.3.5",
23
+ "pillow": "13.0.0",
24
+ "accelerate": "1.16.0",
25
+ "safetensors": "0.8.0",
26
+ "huggingface-hub": "2.4.0",
27
+ "sentencepiece": "0.2.3",
28
+ "protobuf": "7.36.2",
29
+ "librosa": "0.11.0",
30
+ "soundfile": "0.14.0",
31
+ "scipy": "1.17.1"
32
+ },
33
+ "seconds": 6.57,
34
+ "environment_differs": {
35
+ "pillow": "13.0.0 (pinned 12.3.0)",
36
+ "accelerate": "1.16.0 (pinned 1.15.0)",
37
+ "huggingface-hub": "2.4.0 (pinned 2.3.0)",
38
+ "sentencepiece": "0.2.3 (pinned 0.2.2)"
39
+ },
40
+ "platform": "cuda",
41
+ "baseline_repo": "huggingface-mic/gemma3-mic",
42
+ "baseline_revision": "unpublished",
43
+ "baseline_path": "integrations/transformers/expectations/cuda/gemma3-mic.json",
44
+ "template_date": "2026-01-01"
45
+ },
46
+ "outputs": {
47
+ "runtime": {
48
+ "device": "cuda",
49
+ "dtype": "bfloat16",
50
+ "attn_implementation": "sdpa",
51
+ "attn_implementations": {
52
+ "text_config": "sdpa",
53
+ "vision_config": "sdpa"
54
+ }
55
+ },
56
+ "predicted_tokens": [
57
+ "\u10d4\u10d1\u10e3\u10da\u10d8\u10d0"
58
+ ],
59
+ "predicted_text": "\u10d4\u10d1\u10e3\u10da\u10d8\u10d0",
60
+ "answer_logits": [
61
+ [
62
+ 0.70703125,
63
+ 0.703125,
64
+ 0.69921875
65
+ ]
66
+ ],
67
+ "training": {
68
+ "loss": 12.493996620178223,
69
+ "gradients": {
70
+ "model.multi_modal_projector.mm_input_projection_weight": true,
71
+ "model.language_model.embed_tokens.weight": true
72
+ },
73
+ "updated": true
74
+ }
75
+ }
76
+ }
integrations/transformers/expectations/cuda/gemma3-mic.text.json ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/gemma3-mic",
4
+ "contract_name": "mic-gemma3",
5
+ "contract_revision": "unpublished",
6
+ "framework": "transformers",
7
+ "variant": "default",
8
+ "target": "gemma3-mic",
9
+ "kind": "fixture",
10
+ "revision": "7987697a4ca53c8cb7217b7f82c891cf5e6ad09a",
11
+ "source_model": "google/gemma-3-4b-it",
12
+ "weights": "random",
13
+ "fixture_repo": "huggingface-mic/gemma3-mic",
14
+ "environment": {
15
+ "python": "3.11.18",
16
+ "transformers": "5.24.0.dev0",
17
+ "sentence-transformers": null,
18
+ "torch": "2.15.0",
19
+ "torchvision": "0.29.2",
20
+ "torchaudio": "2.11.1",
21
+ "tokenizers": "0.23.3",
22
+ "numpy": "2.3.5",
23
+ "pillow": "13.0.0",
24
+ "accelerate": "1.16.0",
25
+ "safetensors": "0.8.0",
26
+ "huggingface-hub": "2.4.0",
27
+ "sentencepiece": "0.2.3",
28
+ "protobuf": "7.36.2",
29
+ "librosa": "0.11.0",
30
+ "soundfile": "0.14.0",
31
+ "scipy": "1.17.1"
32
+ },
33
+ "seconds": 6.7,
34
+ "environment_differs": {
35
+ "pillow": "13.0.0 (pinned 12.3.0)",
36
+ "accelerate": "1.16.0 (pinned 1.15.0)",
37
+ "huggingface-hub": "2.4.0 (pinned 2.3.0)",
38
+ "sentencepiece": "0.2.3 (pinned 0.2.2)"
39
+ },
40
+ "platform": "cuda",
41
+ "baseline_repo": "huggingface-mic/gemma3-mic",
42
+ "baseline_revision": "unpublished",
43
+ "baseline_path": "integrations/transformers/expectations/cuda/gemma3-mic.json",
44
+ "template_date": "2026-01-01"
45
+ },
46
+ "outputs": {
47
+ "runtime": {
48
+ "device": "cuda",
49
+ "dtype": "bfloat16",
50
+ "attn_implementation": "sdpa",
51
+ "attn_implementations": {
52
+ "text_config": "sdpa",
53
+ "vision_config": "sdpa"
54
+ }
55
+ },
56
+ "predicted_tokens": [
57
+ "\u2581\u0987\u09a8\u09cd\u09a6\u09c1",
58
+ "\u0648\u0627\u062c"
59
+ ],
60
+ "predicted_text": " \u0987\u09a8\u09cd\u09a6\u09c1\u0648\u0627\u062c",
61
+ "answer_logits": [
62
+ [
63
+ 0.6796875,
64
+ 0.66796875,
65
+ 0.6640625
66
+ ],
67
+ [
68
+ 0.71875,
69
+ 0.66015625,
70
+ 0.65625
71
+ ]
72
+ ],
73
+ "training": {
74
+ "loss": 12.520472526550293,
75
+ "gradients": {
76
+ "model.language_model.embed_tokens.weight": true,
77
+ "model.language_model.layers.0.self_attn.q_proj.weight": true
78
+ },
79
+ "updated": true
80
+ }
81
+ }
82
+ }
integrations/transformers/expectations/cuda/gemma3-mic.text_image.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic/gemma3-mic",
4
+ "contract_name": "mic-gemma3",
5
+ "contract_revision": "unpublished",
6
+ "framework": "transformers",
7
+ "variant": "default",
8
+ "target": "gemma3-mic",
9
+ "kind": "fixture",
10
+ "revision": "7987697a4ca53c8cb7217b7f82c891cf5e6ad09a",
11
+ "source_model": "google/gemma-3-4b-it",
12
+ "weights": "random",
13
+ "fixture_repo": "huggingface-mic/gemma3-mic",
14
+ "environment": {
15
+ "python": "3.11.18",
16
+ "transformers": "5.24.0.dev0",
17
+ "sentence-transformers": null,
18
+ "torch": "2.15.0",
19
+ "torchvision": "0.29.2",
20
+ "torchaudio": "2.11.1",
21
+ "tokenizers": "0.23.3",
22
+ "numpy": "2.3.5",
23
+ "pillow": "13.0.0",
24
+ "accelerate": "1.16.0",
25
+ "safetensors": "0.8.0",
26
+ "huggingface-hub": "2.4.0",
27
+ "sentencepiece": "0.2.3",
28
+ "protobuf": "7.36.2",
29
+ "librosa": "0.11.0",
30
+ "soundfile": "0.14.0",
31
+ "scipy": "1.17.1"
32
+ },
33
+ "seconds": 6.64,
34
+ "environment_differs": {
35
+ "pillow": "13.0.0 (pinned 12.3.0)",
36
+ "accelerate": "1.16.0 (pinned 1.15.0)",
37
+ "huggingface-hub": "2.4.0 (pinned 2.3.0)",
38
+ "sentencepiece": "0.2.3 (pinned 0.2.2)"
39
+ },
40
+ "platform": "cuda",
41
+ "baseline_repo": "huggingface-mic/gemma3-mic",
42
+ "baseline_revision": "unpublished",
43
+ "baseline_path": "integrations/transformers/expectations/cuda/gemma3-mic.json",
44
+ "template_date": "2026-01-01"
45
+ },
46
+ "outputs": {
47
+ "runtime": {
48
+ "device": "cuda",
49
+ "dtype": "bfloat16",
50
+ "attn_implementation": "sdpa",
51
+ "attn_implementations": {
52
+ "text_config": "sdpa",
53
+ "vision_config": "sdpa"
54
+ }
55
+ },
56
+ "predicted_tokens": [
57
+ "\u10d4\u10d1\u10e3\u10da\u10d8\u10d0"
58
+ ],
59
+ "predicted_text": "\u10d4\u10d1\u10e3\u10da\u10d8\u10d0",
60
+ "answer_logits": [
61
+ [
62
+ 0.84765625,
63
+ 0.765625,
64
+ 0.66796875
65
+ ]
66
+ ],
67
+ "training": {
68
+ "loss": 12.493707656860352,
69
+ "gradients": {
70
+ "model.multi_modal_projector.mm_input_projection_weight": true,
71
+ "model.language_model.embed_tokens.weight": true
72
+ },
73
+ "updated": true
74
+ }
75
+ }
76
+ }
integrations/transformers/usage.md CHANGED
@@ -4,8 +4,13 @@ This page is the Transformers contract of the Gemma3 MIC and also a usage exampl
4
 
5
  ## Next-token prediction
6
 
 
 
 
7
  ```py runnable:gemma3
 
8
  import torch
 
9
  from transformers import AutoProcessor, AutoModelForCausalLM, set_seed
10
  import json # doc-builder: hide
11
  import os # doc-builder: hide
@@ -13,6 +18,8 @@ import os # doc-builder: hide
13
  model_id = "google/gemma-3-4b-it"
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 data augmentation draw random numbers
18
 
@@ -21,8 +28,15 @@ model = AutoModelForCausalLM.from_pretrained(model_id).to(device)
21
  if variant: # doc-builder: hide
22
  model = AutoModelForCausalLM.from_pretrained(model_id, **variant).to(device)
23
 
24
- prompts = ["The sky is", "Water is"]
25
- inputs = processor(text=prompts, return_tensors="pt", padding=True).to(device)
 
 
 
 
 
 
 
26
 
27
  model.eval()
28
  with torch.no_grad():
 
4
 
5
  ## Next-token prediction
6
 
7
+ The input case is `text`, `image` or `text_image` (each input alone, and both combined); the MIC runner runs every
8
+ case, for every variant.
9
+
10
  ```py runnable:gemma3
11
+ import numpy as np
12
  import torch
13
+ from PIL import Image
14
  from transformers import AutoProcessor, AutoModelForCausalLM, set_seed
15
  import json # doc-builder: hide
16
  import os # doc-builder: hide
 
18
  model_id = "google/gemma-3-4b-it"
19
  model_id = os.environ.get("MIC_MODEL", model_id) # doc-builder: hide
20
  variant = json.loads(os.environ.get("MIC_MODEL_KWARGS", "{}")) # doc-builder: hide
21
+ case = "text_image" # the input case: "text", "image" or "text_image"
22
+ case = os.environ.get("MIC_CASE", case) # doc-builder: hide
23
  device = "cuda" if torch.cuda.is_available() else "cpu"
24
  set_seed(0) # seeds torch, NumPy, and Python: loading, dropout, and data augmentation draw random numbers
25
 
 
28
  if variant: # doc-builder: hide
29
  model = AutoModelForCausalLM.from_pretrained(model_id, **variant).to(device)
30
 
31
+ if case == "text":
32
+ prompts = ["The sky is", "Water is"]
33
+ inputs = processor(text=prompts, return_tensors="pt", padding=True)
34
+ else:
35
+ image = Image.fromarray(np.random.RandomState(0).randint(0, 255, (56, 56, 3), dtype=np.uint8))
36
+ content = [{"type": "image"}] + ([{"type": "text", "text": "Describe this image."}] if case == "text_image" else [])
37
+ prompt = processor.apply_chat_template([{"role": "user", "content": content}], tokenize=False, add_generation_prompt=True)
38
+ inputs = processor(text=[prompt], images=[image], return_tensors="pt")
39
+ inputs = inputs.to(device, dtype=model.dtype) # casts only floating tensors (pixel_values)
40
 
41
  model.eval()
42
  with torch.no_grad():