hf-transformers-bot HF Staff commited on
Commit
73b73cb
·
verified ·
1 Parent(s): ba01439

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/vllm/usage.md"
6
+ ]
7
+ }
README.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - mic
4
+ - test-artifact
5
+ base_model: bigcode/tiny_starcoder_py
6
+ ---
7
+
8
+ # tiny_starcoder_py-vllm-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
+ - [How the fixture was shrunk](https://huggingface-mic-mic-coverage.static.hf.space/shrink/tiny_starcoder_py-vllm-mic.html)
17
+
18
+ ## Contract
19
+
20
+ ### GPTBigCode causal LM (vLLM-compatible fixture)
21
+
22
+ Runnable usage and the framework expectations directory are linked above.
23
+
24
+ ## Slim model
25
+
26
+ ### Slim fixture: tiny_starcoder_py-vllm-mic
27
+
28
+ A 3.7M-parameter fixture for the [tiny_starcoder_py-vllm MIC](https://huggingface.co/huggingface-mic-temp/tiny_starcoder_py-vllm-mic), covering [`bigcode/tiny_starcoder_py`](https://huggingface.co/bigcode/tiny_starcoder_py). It is a test artifact, not a usable model, tagged `test-artifact` to keep it out of candidate-model search.
29
+
30
+ - **Fixture key `060822cf2757`.** It covers every checkpoint whose processor files are byte-identical and whose config matches after shrinking.
31
+ - **Same architecture, smaller config:** `GPTBigCodeForCausalLM`, shrunk by the generic rule in [`sweep.py`](https://github.com/huggingface/transformers-mic/blob/main/experiments/sweep.py) ().
32
+ - **Processor files copied byte for byte** from `bigcode/tiny_starcoder_py`: `generation_config.json`, `merges.txt`, `special_tokens_map.json`, `tokenizer.json`, `tokenizer_config.json`, `vocab.json`.
33
+ - **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: `attention_mask:all_ones`, 0.549), so no training was needed.
34
+ - **Same tensor names as the real checkpoint.** The real checkpoint has every parameter, and so does the fixture.
35
+ - **Saved in float32**, the dtype `bigcode/tiny_starcoder_py` loads in by default.
36
+ - **Finite in float32, bfloat16, and float16** (forward, loss, gradients).
37
+
38
+ 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 tiny_starcoder_py-vllm-mic`.
build.json ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fixture": "huggingface-mic-temp/tiny_starcoder_py-vllm-mic",
3
+ "key": "060822cf2757abb77ba74805ef4673661f4a087c55598ab9d180b19afda98ead",
4
+ "key_fields": {
5
+ "architectures": [
6
+ "GPTBigCodeForCausalLM"
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
+ "vocab_size": 49152,
22
+ "n_positions": 8192,
23
+ "n_embd": 64,
24
+ "n_layer": 2,
25
+ "n_head": 2,
26
+ "n_inner": 128,
27
+ "activation_function": "gelu_pytorch_tanh",
28
+ "resid_pdrop": 0.1,
29
+ "embd_pdrop": 0.1,
30
+ "attn_pdrop": 0.1,
31
+ "layer_norm_epsilon": 1e-05,
32
+ "initializer_range": 0.02,
33
+ "scale_attn_weights": true,
34
+ "use_cache": true,
35
+ "bos_token_id": 0,
36
+ "eos_token_id": 0,
37
+ "pad_token_id": null,
38
+ "attention_softmax_in_fp32": true,
39
+ "scale_attention_softmax_in_fp32": true,
40
+ "multi_query": true,
41
+ "add_cross_attention": false,
42
+ "tie_word_embeddings": true,
43
+ "num_key_value_heads": 1,
44
+ "inference_runner": 0,
45
+ "max_batch_size": null,
46
+ "max_sequence_length": null,
47
+ "model_type": "gpt_bigcode",
48
+ "pad_key_length": true,
49
+ "pre_allocate_kv_cache": false,
50
+ "summary_activation": null,
51
+ "summary_first_dropout": 0.1,
52
+ "summary_proj_to_labels": true,
53
+ "summary_type": "cls_index",
54
+ "summary_use_proj": true,
55
+ "validate_runner_input": true,
56
+ "output_attentions": false
57
+ },
58
+ "covers": {
59
+ "bigcode/tiny_starcoder_py": "8547527bef0bc927268c1653cce6948c5c242dd1"
60
+ },
61
+ "built_from": {
62
+ "repo": "bigcode/tiny_starcoder_py",
63
+ "revision": "8547527bef0bc927268c1653cce6948c5c242dd1"
64
+ },
65
+ "seed": 17,
66
+ "dtype": "float32",
67
+ "builder": "example/build_fixtures.py",
68
+ "builder_revision": null,
69
+ "recipe": {
70
+ "seed": 17,
71
+ "model_class": "GPTBigCodeForCausalLM",
72
+ "config_overrides": {
73
+ "fields": {
74
+ "n_head": 2,
75
+ "num_key_value_heads": 1
76
+ },
77
+ "reason": "vLLM's Transformers backend on CPU supports head widths [32, 48, 64, 80]...; the shrink rule gives 16. 4 heads of 16 -> 2 of 32 keeps the q/o projection shapes; the k/v projections grow (weights sized by the head width, e.g. q/k norms, grow). (serving profile vllm-cpu v1)"
78
+ }
79
+ },
80
+ "shrink": "rule",
81
+ "model_class": "GPTBigCodeForCausalLM",
82
+ "parameters": 3728768,
83
+ "missing_parameters": [],
84
+ "serialization": {
85
+ "file": "model.safetensors",
86
+ "source_file": "model.safetensors",
87
+ "reverted_conversions": []
88
+ },
89
+ "checkpoint_inspection": "parameter headers/indexes; bounded binary fallback",
90
+ "numeric_health_scope": "CPU float32/bfloat16/float16; autocast for low-precision losses",
91
+ "captured": {
92
+ "call": "training step",
93
+ "inputs": [
94
+ "attention_mask",
95
+ "input_ids",
96
+ "labels"
97
+ ],
98
+ "class": "GPTBigCodeForCausalLM"
99
+ },
100
+ "weights": "random",
101
+ "gate": {
102
+ "random": {
103
+ "pass": true,
104
+ "accepted_insensitive": {},
105
+ "threshold": 0.001,
106
+ "deltas": {
107
+ "input_ids:roll_batch": 1.2897167205810547,
108
+ "input_ids:reverse": 1.189239740371704,
109
+ "attention_mask:all_ones": 0.5487403869628906
110
+ },
111
+ "weakest": "attention_mask:all_ones",
112
+ "no_perturbation_defined": [],
113
+ "not_a_forward_parameter": []
114
+ }
115
+ },
116
+ "numeric_health": {
117
+ "float32": {
118
+ "outputs_finite": true,
119
+ "loss_finite": true,
120
+ "gradients_finite": true,
121
+ "finite": true
122
+ },
123
+ "bfloat16": {
124
+ "outputs_finite": true,
125
+ "loss_finite": true,
126
+ "gradients_finite": true,
127
+ "finite": true
128
+ },
129
+ "float16": {
130
+ "outputs_finite": true,
131
+ "loss_finite": true,
132
+ "unscaled_gradients_finite": true,
133
+ "finite": true
134
+ }
135
+ },
136
+ "copied_unchanged": [
137
+ "generation_config.json",
138
+ "merges.txt",
139
+ "special_tokens_map.json",
140
+ "tokenizer.json",
141
+ "tokenizer_config.json",
142
+ "vocab.json"
143
+ ],
144
+ "environment": {
145
+ "python": "3.11.18",
146
+ "machine": "x86_64",
147
+ "torch": "2.14.0+cpu",
148
+ "transformers": "5.25.0.dev0",
149
+ "tokenizers": "0.23.3"
150
+ },
151
+ "sha256": {
152
+ "config.json": "d9a863247cb803c3b8506f5268803c7aeb91c261a60193dd2ebe7c5b9e229c06",
153
+ "generation_config.json": "368f15f9c335d48e1a585440037c77022af6b867303dc8fe9ee01e8fc86c1617",
154
+ "merges.txt": "74b0a4bc1a97ebc1d227f69231b18574374ba052fb945b0fa0aa91d3c32504a2",
155
+ "model.safetensors": "726a98689c2ba58d67f6a0c2faeb22547ff5aa5a1c0220fdab2893009c281915",
156
+ "special_tokens_map.json": "0823292e24ea07b89317e9ede9d08da2a1b6c014290c06908a7ad04f1efd6719",
157
+ "tokenizer.json": "42b5a37ba11199f024f2b8873e1ecba98da33166e16f700bf7cb2304b0a5583f",
158
+ "tokenizer_config.json": "95684c52ad9a970dbbb17576ee2237cb62902c1eff6804c7c91a4d6219a4a6d7",
159
+ "vocab.json": "20175afb9f164fad4829aca2279f8df7eeff1e2e3f671378aaa287a740aff09f"
160
+ }
161
+ }
config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_function": "gelu_pytorch_tanh",
3
+ "add_cross_attention": false,
4
+ "architectures": [
5
+ "GPTBigCodeForCausalLM"
6
+ ],
7
+ "attention_softmax_in_fp32": true,
8
+ "attn_pdrop": 0.1,
9
+ "bos_token_id": 0,
10
+ "dtype": "float32",
11
+ "embd_pdrop": 0.1,
12
+ "eos_token_id": 0,
13
+ "inference_runner": 0,
14
+ "initializer_range": 0.02,
15
+ "layer_norm_epsilon": 1e-05,
16
+ "max_batch_size": null,
17
+ "max_sequence_length": null,
18
+ "model_type": "gpt_bigcode",
19
+ "multi_query": true,
20
+ "n_embd": 64,
21
+ "n_head": 2,
22
+ "n_inner": 128,
23
+ "n_layer": 2,
24
+ "n_positions": 8192,
25
+ "num_key_value_heads": 1,
26
+ "pad_key_length": true,
27
+ "pad_token_id": null,
28
+ "pre_allocate_kv_cache": false,
29
+ "resid_pdrop": 0.1,
30
+ "scale_attention_softmax_in_fp32": true,
31
+ "scale_attn_weights": true,
32
+ "summary_activation": null,
33
+ "summary_first_dropout": 0.1,
34
+ "summary_proj_to_labels": true,
35
+ "summary_type": "cls_index",
36
+ "summary_use_proj": true,
37
+ "tie_word_embeddings": true,
38
+ "transformers_version": "5.25.0.dev0",
39
+ "use_cache": true,
40
+ "validate_runner_input": true,
41
+ "vocab_size": 49152
42
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 0,
5
+ "transformers_version": "4.28.1"
6
+ }
integration.json ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mic": "0.3",
3
+ "name": "GPTBigCode causal LM (vLLM-compatible fixture)",
4
+ "usage": "vLLM LLM(model_impl='transformers') vs Transformers greedy generation: backend, tokens and per-step logits",
5
+ "architecture": "GPTBigCodeForCausalLM",
6
+ "checkpoints": {
7
+ "bigcode/tiny_starcoder_py": {
8
+ "fixture": "huggingface-mic-temp/tiny_starcoder_py-vllm-mic"
9
+ }
10
+ },
11
+ "fixtures": {
12
+ "huggingface-mic-temp/tiny_starcoder_py-vllm-mic": {
13
+ "built_from": "bigcode/tiny_starcoder_py",
14
+ "covers": [
15
+ "bigcode/tiny_starcoder_py"
16
+ ],
17
+ "build": {
18
+ "seed": 17,
19
+ "model_class": "GPTBigCodeForCausalLM",
20
+ "config_overrides": {
21
+ "fields": {
22
+ "n_head": 2,
23
+ "num_key_value_heads": 1
24
+ },
25
+ "reason": "vLLM's Transformers backend on CPU supports head widths [32, 48, 64, 80]...; the shrink rule gives 16. 4 heads of 16 -> 2 of 32 keeps the q/o projection shapes; the k/v projections grow (weights sized by the head width, e.g. q/k norms, grow). (serving profile vllm-cpu v1)"
26
+ }
27
+ }
28
+ }
29
+ },
30
+ "integrations": {
31
+ "vllm": {
32
+ "entry_point": "integrations/vllm/usage.md",
33
+ "format": "runnable-markdown",
34
+ "requires": [
35
+ "vllm",
36
+ "transformers>=5",
37
+ "torch"
38
+ ],
39
+ "targets": [
40
+ "fixtures"
41
+ ],
42
+ "variants": {
43
+ "default": {
44
+ "dtype": "float32"
45
+ }
46
+ },
47
+ "training": false,
48
+ "resources": {
49
+ "fixture": {
50
+ "memory_gb": 2,
51
+ "download_mb": 50
52
+ }
53
+ },
54
+ "outputs": {
55
+ "runtime": {
56
+ "compare": "exact"
57
+ },
58
+ "checks": {
59
+ "compare": "all_true"
60
+ }
61
+ }
62
+ }
63
+ },
64
+ "outputs": {
65
+ "runtime": {
66
+ "compare": "exact"
67
+ },
68
+ "predicted_tokens": {
69
+ "compare": "exact"
70
+ },
71
+ "predicted_text": {
72
+ "compare": "exact"
73
+ },
74
+ "next_token_logits": {
75
+ "compare": "allclose",
76
+ "atol": 0.0001,
77
+ "rtol": 0.0001
78
+ },
79
+ "training.loss": {
80
+ "compare": "allclose",
81
+ "atol": 0.0001,
82
+ "rtol": 0.0001
83
+ },
84
+ "training.gradients": {
85
+ "compare": "all_true"
86
+ },
87
+ "training.updated": {
88
+ "compare": "true"
89
+ }
90
+ }
91
+ }
integrations/vllm/expectations/cpu-x86_64/tiny_starcoder_py-vllm-mic.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "recorded_with": {
3
+ "contract": "huggingface-mic-temp/tiny_starcoder_py-vllm-mic",
4
+ "contract_name": "tiny_starcoder_py-vllm",
5
+ "contract_revision": "unpublished",
6
+ "framework": "vllm",
7
+ "variant": "default",
8
+ "target": "tiny_starcoder_py-vllm-mic",
9
+ "case": null,
10
+ "kind": "fixture",
11
+ "revision": "unpublished",
12
+ "source_model": "bigcode/tiny_starcoder_py",
13
+ "weights": "random",
14
+ "fixture_repo": "huggingface-mic-temp/tiny_starcoder_py-vllm-mic",
15
+ "environment": {
16
+ "python": "3.11.18",
17
+ "transformers": "5.25.0.dev0",
18
+ "sentence-transformers": null,
19
+ "torch": "2.14.0+cpu",
20
+ "torchvision": "0.29.2+cpu",
21
+ "torchaudio": "2.11.1+cpu",
22
+ "tokenizers": "0.23.3",
23
+ "numpy": "2.3.5",
24
+ "pillow": "13.0.0",
25
+ "accelerate": "1.16.0",
26
+ "safetensors": "0.8.0",
27
+ "huggingface-hub": "2.5.0",
28
+ "sentencepiece": "0.2.3",
29
+ "protobuf": "7.36.2",
30
+ "librosa": "0.11.0",
31
+ "soundfile": "0.14.0",
32
+ "scipy": "1.17.1"
33
+ },
34
+ "seconds": 15.39,
35
+ "environment_differs": {
36
+ "torch": "2.14.0+cpu (pinned 2.15.0)",
37
+ "pillow": "13.0.0 (pinned 12.3.0)",
38
+ "accelerate": "1.16.0 (pinned 1.15.0)",
39
+ "huggingface-hub": "2.5.0 (pinned 2.3.0)",
40
+ "sentencepiece": "0.2.3 (pinned 0.2.2)"
41
+ },
42
+ "platform": "cpu-x86_64",
43
+ "baseline_repo": "huggingface-mic-temp/tiny_starcoder_py-vllm-mic",
44
+ "baseline_revision": "unpublished",
45
+ "baseline_path": "integrations/vllm/expectations/cpu-x86_64/tiny_starcoder_py-vllm-mic.json"
46
+ },
47
+ "outputs": {
48
+ "runtime": {
49
+ "device": "cpu",
50
+ "dtype": "float32"
51
+ },
52
+ "checks": {
53
+ "transformers_backend": true,
54
+ "steps_captured": true,
55
+ "tokens_equal": true,
56
+ "logits_close": true
57
+ },
58
+ "max_abs_logit_diff": 4.76837158203125e-07
59
+ }
60
+ }
integrations/vllm/usage.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GPTBigCode causal LM: vLLM Transformers backend
2
+
3
+ This page is the vLLM contract of the GPTBigCode causal LM MIC and also a usage example: vLLM serves the model with its
4
+ [Transformers modeling backend](https://docs.vllm.ai/en/latest/models/supported_models.html#transformers)
5
+ (`model_impl="transformers"`), which runs the Transformers modeling code inside vLLM's engine (paged KV cache,
6
+ continuous batching, vLLM attention). The MIC runner runs the block below against the slim fixture in
7
+ [`integration.json`](../../integration.json). Lines marked `# doc-builder: hide` only matter there.
8
+
9
+ The check is differential: Transformers and vLLM run the same weights in the same process, and the contract
10
+ asserts that vLLM picked the Transformers backend, generates the same greedy tokens and produces the same logits
11
+ at every step (prefill and decode, two prompts of different lengths batched together). It fails when a change in
12
+ Transformers breaks what the backend relies on (attention dispatch through `ALL_ATTENTION_FUNCTIONS`, kwargs
13
+ propagation, positions, weight names, config fields), not when modeling math changes, which moves both sides alike
14
+ and is covered by the Transformers contract.
15
+
16
+ ## Greedy generation: vLLM vs Transformers
17
+
18
+ ```py runnable:usage
19
+ import json # doc-builder: hide
20
+ import os
21
+
22
+ os.environ.setdefault("VLLM_ENABLE_V1_MULTIPROCESSING", "0") # in-process engine, so the logits can be read below
23
+ import torch
24
+ from transformers import AutoModelForCausalLM, AutoTokenizer
25
+ from vllm import LLM, SamplingParams
26
+
27
+ model_id = "bigcode/tiny_starcoder_py"
28
+ model_id = os.environ.get("MIC_MODEL", model_id) # doc-builder: hide
29
+ revision = os.environ.get("MIC_MODEL_REVISION") or None # doc-builder: hide
30
+ variant = json.loads(os.environ.get("MIC_MODEL_KWARGS", "{}")) # doc-builder: hide
31
+ dtype = variant.get("dtype", "float32")
32
+ device = "cuda" if torch.cuda.is_available() else "cpu"
33
+ prompts = ["The capital of France is", "The sky is blue because"]
34
+ max_new_tokens = 6
35
+
36
+ # Reference: Transformers, one prompt at a time (no padding), greedy
37
+ tokenizer = AutoTokenizer.from_pretrained(model_id, revision=revision)
38
+ model = AutoModelForCausalLM.from_pretrained(model_id, revision=revision, dtype=dtype).to(device).eval()
39
+ ref_tokens, ref_logits = [], []
40
+ for prompt in prompts:
41
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
42
+ with torch.no_grad():
43
+ out = model.generate(input_ids, max_new_tokens=max_new_tokens, do_sample=False, output_logits=True, return_dict_in_generate=True)
44
+ ref_tokens.append(out.sequences[0, input_ids.shape[1]:].tolist())
45
+ ref_logits.append(torch.stack([step[0].float().cpu() for step in out.logits]))
46
+ del model
47
+
48
+ # vLLM with the Transformers backend, both prompts batched
49
+ llm = LLM(model=model_id, revision=revision, model_impl="transformers", dtype=dtype, max_model_len=256, enforce_eager=True, seed=0)
50
+ captured = []
51
+
52
+
53
+ def record_logits(vllm_model):
54
+ compute_logits = vllm_model.compute_logits
55
+
56
+ def wrapper(*args, **kwargs):
57
+ logits = compute_logits(*args, **kwargs)
58
+ captured.append(logits.detach().float().cpu().clone())
59
+ return logits
60
+
61
+ vllm_model.compute_logits = wrapper
62
+ return type(vllm_model).__name__
63
+
64
+
65
+ backend = llm.apply_model(record_logits)[0]
66
+ outputs = llm.generate(prompts, SamplingParams(temperature=0.0, max_tokens=max_new_tokens, ignore_eos=True))
67
+ tokens = [list(o.outputs[0].token_ids) for o in outputs]
68
+ # one logits row per request at every step, in prompt order (both requests run every step)
69
+ logits = [torch.stack([step[i] for step in captured[:max_new_tokens]]) for i in range(len(prompts))]
70
+ tolerance = 1e-4 if dtype == "float32" else 5e-2
71
+ max_diff = max((a - b).abs().max().item() for a, b in zip(ref_logits, logits))
72
+ print(backend, tokens, f"max |logit diff| = {max_diff:.2e}")
73
+
74
+ if os.environ.get("MIC_RUNNER"): # doc-builder: hide
75
+ result = {
76
+ "runtime": {"device": device, "dtype": dtype},
77
+ "checks": {
78
+ "transformers_backend": backend in ("TransformersForCausalLM", "TransformersMoEForCausalLM"),
79
+ "steps_captured": len(captured) >= max_new_tokens and all(c.shape[0] == len(prompts) for c in captured[:max_new_tokens]),
80
+ "tokens_equal": tokens == ref_tokens,
81
+ "logits_close": all(torch.allclose(a, b, atol=tolerance, rtol=tolerance) for a, b in zip(ref_logits, logits)),
82
+ },
83
+ "max_abs_logit_diff": max_diff,
84
+ }
85
+ print(json.dumps(result))
86
+ ```
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:726a98689c2ba58d67f6a0c2faeb22547ff5aa5a1c0220fdab2893009c281915
3
+ size 14917704
special_tokens_map.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|endoftext|>",
4
+ "<fim_prefix>",
5
+ "<fim_middle>",
6
+ "<fim_suffix>",
7
+ "<fim_pad>",
8
+ "<filename>",
9
+ "<gh_stars>",
10
+ "<issue_start>",
11
+ "<issue_comment>",
12
+ "<issue_closed>",
13
+ "<jupyter_start>",
14
+ "<jupyter_text>",
15
+ "<jupyter_code>",
16
+ "<jupyter_output>",
17
+ "<empty_output>",
18
+ "<commit_before>",
19
+ "<commit_msg>",
20
+ "<commit_after>",
21
+ "<reponame>"
22
+ ],
23
+ "bos_token": "<|endoftext|>",
24
+ "eos_token": "<|endoftext|>",
25
+ "unk_token": "<|endoftext|>"
26
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "additional_special_tokens": [
4
+ "<|endoftext|>",
5
+ "<fim_prefix>",
6
+ "<fim_middle>",
7
+ "<fim_suffix>",
8
+ "<fim_pad>",
9
+ "<filename>",
10
+ "<gh_stars>",
11
+ "<issue_start>",
12
+ "<issue_comment>",
13
+ "<issue_closed>",
14
+ "<jupyter_start>",
15
+ "<jupyter_text>",
16
+ "<jupyter_code>",
17
+ "<jupyter_output>",
18
+ "<empty_output>",
19
+ "<commit_before>",
20
+ "<commit_msg>",
21
+ "<commit_after>",
22
+ "<reponame>"
23
+ ],
24
+ "bos_token": "<|endoftext|>",
25
+ "eos_token": "<|endoftext|>",
26
+ "model_max_length": 1000000000000000019884624838656,
27
+ "tokenizer_class": "GPT2Tokenizer",
28
+ "unk_token": "<|endoftext|>",
29
+ "vocab_size": 49152
30
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff