mlboydaisuke commited on
Commit
1ac3254
·
verified ·
1 Parent(s): 2f96f3c

Add macos-fp16/: re-export with apple/coreai-models 97a14be (gate vs fp32 PASS; see MANIFEST.json)

Browse files
.gitattributes CHANGED
@@ -44,3 +44,8 @@ VAEEncoder_half.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
44
  Transformer_edit.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
45
  Transformer_edit_512.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
46
  Transformer_edit_2ref.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
44
  Transformer_edit.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
45
  Transformer_edit_512.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
46
  Transformer_edit_2ref.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
47
+ macos-fp16/TextEncoder.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
48
+ macos-fp16/Transformer.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
49
+ macos-fp16/VAEDecoder.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
50
+ macos-fp16/VAEEncoder.aimodel/main.mlirb filter=lfs diff=lfs merge=lfs -text
51
+ macos-fp16/tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
macos-fp16/MANIFEST.json ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "folder": "macos-fp16",
3
+ "hf_repo": "mlboydaisuke/FLUX.2-klein-4B-CoreAI",
4
+ "source": "black-forest-labs/FLUX.2-klein-4B @ e7b7dc27f91deacad38e78976d1f2b499d76a294",
5
+ "exporter": "apple/coreai-models @ 97a14be40bb1c5b95badb08b8532530443d62d26 (2026-10-09), coreai-core 1.0.0b3, coreai-torch 0.4.3, coreai-opt 0.3.0, torch 2.9.0, diffusers 0.37.1",
6
+ "runtime": "apple/coreai-models 97a14be Swift FlowTransformerPipeline, macOS 27.0 (26A428), GPU",
7
+ "gate_reference": "fp32 PyTorch (diffusers Flux2KleinPipeline through upstream's export wrappers, MPS); inputs built the way the Swift pipeline builds them; 4 prompts, seed 42",
8
+ "export_command": "uv run coreai.diffusion.export flux2-klein-4b --platform macOS --compression none --single-function --resolution 1024",
9
+ "weights": "float16 (no quantization), float16 compute; one asset per graph (single-function, 1024)",
10
+ "left_out": "Transformer_img2img_full.aimodel (the 1024 img2img transformer of the same export): this folder runs text-to-image only",
11
+ "gate": "PASS at 0.999: (i) text encoder mean token cos 0.99966-0.99995 over 4 prompts; (ii) transformer step-1 output cos 0.999987, rel-L2 0.0051; (iii) VAE decoder 65.5 dB; end-to-end seed-42 image vs fp32 diffusers 31.0 dB",
12
+ "speed": "10.88 s per 1024x1024 image, 4 steps (median of 4 warm runs, 10.86-10.92 s), M4 Max, sample app",
13
+ "files": [
14
+ {
15
+ "path": "TextEncoder.aimodel/main.hash",
16
+ "bytes": 32,
17
+ "sha256": "84244e4bec7e50d8d38a64e0491af8604ff2ff0e6c78784719c46cae5e239c48"
18
+ },
19
+ {
20
+ "path": "TextEncoder.aimodel/main.mlirb",
21
+ "bytes": 6228947553,
22
+ "sha256": "49fa812eecb58928a07e9cd9b4cec930e5871562bb2d32338bfc7ac55402c04a"
23
+ },
24
+ {
25
+ "path": "TextEncoder.aimodel/metadata.json",
26
+ "bytes": 396,
27
+ "sha256": "38481dcf3cb4045952d4af0724df6650de43d76115bd76ff7effccff8aadfcfd"
28
+ },
29
+ {
30
+ "path": "Transformer.aimodel/main.hash",
31
+ "bytes": 32,
32
+ "sha256": "54de5780e30531faa3bdcd75d3cb53ba5f6ff3dd83fc8a385eed9b1709d2c3dd"
33
+ },
34
+ {
35
+ "path": "Transformer.aimodel/main.mlirb",
36
+ "bytes": 7751312967,
37
+ "sha256": "85b261f2754376262b9ea59febdf398904897cd9dc8ba3db1869a23f9347e999"
38
+ },
39
+ {
40
+ "path": "Transformer.aimodel/metadata.json",
41
+ "bytes": 396,
42
+ "sha256": "e543de77f2f3a6283f7a576a8f794baa8db56a1039333e92f38c38f5738512bb"
43
+ },
44
+ {
45
+ "path": "VAEDecoder.aimodel/main.hash",
46
+ "bytes": 32,
47
+ "sha256": "16e1ed4549e53ec3fc42119dd5a19c3968fe323b62ad2fc4963d1a81f0b950c1"
48
+ },
49
+ {
50
+ "path": "VAEDecoder.aimodel/main.mlirb",
51
+ "bytes": 99294680,
52
+ "sha256": "6d126ef2698df7356cf8f5b209e7c3a52224b2b709177becde73ac91fb851bec"
53
+ },
54
+ {
55
+ "path": "VAEDecoder.aimodel/metadata.json",
56
+ "bytes": 395,
57
+ "sha256": "73534fda1e0b087b67b6598a8365c36309888565d865a14122a5002f3db898f7"
58
+ },
59
+ {
60
+ "path": "VAEEncoder.aimodel/main.hash",
61
+ "bytes": 32,
62
+ "sha256": "aedb133dfb199d69fc1fd22b899f30a5bf7b3171503c019adf4e4ca44ccab7e2"
63
+ },
64
+ {
65
+ "path": "VAEEncoder.aimodel/main.mlirb",
66
+ "bytes": 68896263,
67
+ "sha256": "302b2662ff2d8b3ba4d47a6ef46b88aeae21b8867b9848e4d50660c92d30e670"
68
+ },
69
+ {
70
+ "path": "VAEEncoder.aimodel/metadata.json",
71
+ "bytes": 395,
72
+ "sha256": "a2f538a4f218fc05470e2c14d15bc4993dcd173ca1cc97b680455219388e6fde"
73
+ },
74
+ {
75
+ "path": "metadata.json",
76
+ "bytes": 974,
77
+ "sha256": "3d9037cbb42710dd2a08397b1ce549b5abc7f1ca32740bd7845900b34aee354c"
78
+ },
79
+ {
80
+ "path": "tokenizer/chat_template.jinja",
81
+ "bytes": 4168,
82
+ "sha256": "a55ee1b1660128b7098723e0abcd92caa0788061051c62d51cbe87d9cf1974d8"
83
+ },
84
+ {
85
+ "path": "tokenizer/config.json",
86
+ "bytes": 375,
87
+ "sha256": "b3f99a222a3edef3a756b61f6a67ada791c631aba983c13f59cb45aa9f6fb5f4"
88
+ },
89
+ {
90
+ "path": "tokenizer/tokenizer.json",
91
+ "bytes": 11422650,
92
+ "sha256": "be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506"
93
+ },
94
+ {
95
+ "path": "tokenizer/tokenizer_config.json",
96
+ "bytes": 375,
97
+ "sha256": "b3f99a222a3edef3a756b61f6a67ada791c631aba983c13f59cb45aa9f6fb5f4"
98
+ },
99
+ {
100
+ "path": "vae_bn_mean.npy",
101
+ "bytes": 640,
102
+ "sha256": "b2e3b98b3b1483e4573093d41b9e3890627724c7c0bfaa215ba1e2ef151b6d09"
103
+ },
104
+ {
105
+ "path": "vae_bn_var.npy",
106
+ "bytes": 640,
107
+ "sha256": "9418da87092c06ffb4f72402e3c3d142b671878f6cea5e8da3c547befbd64861"
108
+ }
109
+ ],
110
+ "file_count": 19,
111
+ "total_bytes": 14159882995,
112
+ "text_to_image_files": [
113
+ "metadata.json",
114
+ "tokenizer/chat_template.jinja",
115
+ "tokenizer/config.json",
116
+ "tokenizer/tokenizer.json",
117
+ "tokenizer/tokenizer_config.json",
118
+ "vae_bn_mean.npy",
119
+ "vae_bn_var.npy",
120
+ "VAEDecoder.aimodel/main.hash",
121
+ "VAEDecoder.aimodel/metadata.json",
122
+ "VAEDecoder.aimodel/main.mlirb",
123
+ "TextEncoder.aimodel/main.hash",
124
+ "TextEncoder.aimodel/metadata.json",
125
+ "TextEncoder.aimodel/main.mlirb",
126
+ "Transformer.aimodel/main.hash",
127
+ "Transformer.aimodel/metadata.json",
128
+ "Transformer.aimodel/main.mlirb"
129
+ ],
130
+ "text_to_image_bytes": 14090986305
131
+ }
macos-fp16/TextEncoder.aimodel/main.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ I��.쵉(�~�ٴ��0�b�-23��z�T�J
macos-fp16/TextEncoder.aimodel/main.mlirb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:49fa812eecb58928a07e9cd9b4cec930e5871562bb2d32338bfc7ac55402c04a
3
+ size 6228947553
macos-fp16/TextEncoder.aimodel/metadata.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "license" : "Apache-2.0",
3
+ "assetVersion" : "2.0",
4
+ "producer" : "coreai-core 1.0.0b3",
5
+ "author" : "Black Forest Labs",
6
+ "description" : "FLUX.2 [klein] 4B is a distilled, open-weights text-to-image rectified-flow transformer from Black Forest Labs. Source: https:\/\/huggingface.co\/black-forest-labs\/FLUX.2-klein-4B — TextEncoder component.",
7
+ "creationDate" : "20261009T205251Z"
8
+ }
macos-fp16/Transformer.aimodel/main.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ ��a�uCv&+�����9��|�܋��i�?�G�
macos-fp16/Transformer.aimodel/main.mlirb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:85b261f2754376262b9ea59febdf398904897cd9dc8ba3db1869a23f9347e999
3
+ size 7751312967
macos-fp16/Transformer.aimodel/metadata.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "license" : "Apache-2.0",
3
+ "assetVersion" : "2.0",
4
+ "producer" : "coreai-core 1.0.0b3",
5
+ "author" : "Black Forest Labs",
6
+ "description" : "FLUX.2 [klein] 4B is a distilled, open-weights text-to-image rectified-flow transformer from Black Forest Labs. Source: https:\/\/huggingface.co\/black-forest-labs\/FLUX.2-klein-4B — Transformer component.",
7
+ "creationDate" : "20261009T205229Z"
8
+ }
macos-fp16/VAEDecoder.aimodel/main.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ mn�i��5l��� �å"$�� {��s�����
macos-fp16/VAEDecoder.aimodel/main.mlirb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d126ef2698df7356cf8f5b209e7c3a52224b2b709177becde73ac91fb851bec
3
+ size 99294680
macos-fp16/VAEDecoder.aimodel/metadata.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "author" : "Black Forest Labs",
3
+ "license" : "Apache-2.0",
4
+ "creationDate" : "20261009T205254Z",
5
+ "description" : "FLUX.2 [klein] 4B is a distilled, open-weights text-to-image rectified-flow transformer from Black Forest Labs. Source: https:\/\/huggingface.co\/black-forest-labs\/FLUX.2-klein-4B — VAEDecoder component.",
6
+ "producer" : "coreai-core 1.0.0b3",
7
+ "assetVersion" : "2.0"
8
+ }
macos-fp16/VAEEncoder.aimodel/main.hash ADDED
@@ -0,0 +1 @@
 
 
1
+ 0+&b�-�;��zn�k���!��{�H��`�-0�p
macos-fp16/VAEEncoder.aimodel/main.mlirb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:302b2662ff2d8b3ba4d47a6ef46b88aeae21b8867b9848e4d50660c92d30e670
3
+ size 68896263
macos-fp16/VAEEncoder.aimodel/metadata.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "author" : "Black Forest Labs",
3
+ "license" : "Apache-2.0",
4
+ "creationDate" : "20261009T205255Z",
5
+ "description" : "FLUX.2 [klein] 4B is a distilled, open-weights text-to-image rectified-flow transformer from Black Forest Labs. Source: https:\/\/huggingface.co\/black-forest-labs\/FLUX.2-klein-4B — VAEEncoder component.",
6
+ "producer" : "coreai-core 1.0.0b3",
7
+ "assetVersion" : "2.0"
8
+ }
macos-fp16/metadata.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata_version": "0.2",
3
+ "kind": "diffusion",
4
+ "name": "FLUX.2-klein-4B",
5
+ "assets": {
6
+ "transformer": "Transformer.aimodel",
7
+ "transformer_img2img_full": "Transformer_img2img_full.aimodel",
8
+ "text_encoder": "TextEncoder.aimodel",
9
+ "vae_decoder": "VAEDecoder.aimodel",
10
+ "vae_encoder": "VAEEncoder.aimodel"
11
+ },
12
+ "diffusion": {
13
+ "type": "flux2",
14
+ "prediction_type": "flow_matching",
15
+ "encoder_scale_factor": 1.0,
16
+ "decoder_scale_factor": 1.0,
17
+ "decoder_shift_factor": 0.0,
18
+ "batch_norm_eps": 0.0001,
19
+ "guidance_embeds": false,
20
+ "image_size": 1024,
21
+ "default_guidance_scale": 1.0,
22
+ "default_steps": 4,
23
+ "rope_axes_dims": [
24
+ 32,
25
+ 32,
26
+ 32,
27
+ 32
28
+ ],
29
+ "rope_theta": 2000
30
+ },
31
+ "source": {
32
+ "model_definition": "torch",
33
+ "hf_model_id": "black-forest-labs/FLUX.2-klein-4B"
34
+ },
35
+ "compression": null,
36
+ "compilation": {
37
+ "date": "2026-10-10T05:52:55.418637+09:00",
38
+ "targets": []
39
+ }
40
+ }
macos-fp16/tokenizer/chat_template.jinja ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- set reasoning_content = message.reasoning_content %}
37
+ {%- else %}
38
+ {%- if '</think>' in content %}
39
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
+ {%- endif %}
42
+ {%- endif %}
43
+ {%- if loop.index0 > ns.last_query_index %}
44
+ {%- if loop.last or (not loop.last and reasoning_content) %}
45
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
+ {%- else %}
47
+ {{- '<|im_start|>' + message.role + '\n' + content }}
48
+ {%- endif %}
49
+ {%- else %}
50
+ {{- '<|im_start|>' + message.role + '\n' + content }}
51
+ {%- endif %}
52
+ {%- if message.tool_calls %}
53
+ {%- for tool_call in message.tool_calls %}
54
+ {%- if (loop.first and content) or (not loop.first) %}
55
+ {{- '\n' }}
56
+ {%- endif %}
57
+ {%- if tool_call.function %}
58
+ {%- set tool_call = tool_call.function %}
59
+ {%- endif %}
60
+ {{- '<tool_call>\n{"name": "' }}
61
+ {{- tool_call.name }}
62
+ {{- '", "arguments": ' }}
63
+ {%- if tool_call.arguments is string %}
64
+ {{- tool_call.arguments }}
65
+ {%- else %}
66
+ {{- tool_call.arguments | tojson }}
67
+ {%- endif %}
68
+ {{- '}\n</tool_call>' }}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {{- '<|im_end|>\n' }}
72
+ {%- elif message.role == "tool" %}
73
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
74
+ {{- '<|im_start|>user' }}
75
+ {%- endif %}
76
+ {{- '\n<tool_response>\n' }}
77
+ {{- content }}
78
+ {{- '\n</tool_response>' }}
79
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
80
+ {{- '<|im_end|>\n' }}
81
+ {%- endif %}
82
+ {%- endif %}
83
+ {%- endfor %}
84
+ {%- if add_generation_prompt %}
85
+ {{- '<|im_start|>assistant\n' }}
86
+ {%- if enable_thinking is defined and enable_thinking is false %}
87
+ {{- '<think>\n\n</think>\n\n' }}
88
+ {%- endif %}
89
+ {%- endif %}
macos-fp16/tokenizer/config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": true,
9
+ "local_files_only": false,
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "GPT2Tokenizer",
14
+ "unk_token": null
15
+ }
macos-fp16/tokenizer/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
3
+ size 11422650
macos-fp16/tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": true,
9
+ "local_files_only": false,
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "GPT2Tokenizer",
14
+ "unk_token": null
15
+ }
macos-fp16/vae_bn_mean.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2e3b98b3b1483e4573093d41b9e3890627724c7c0bfaa215ba1e2ef151b6d09
3
+ size 640
macos-fp16/vae_bn_var.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9418da87092c06ffb4f72402e3c3d142b671878f6cea5e8da3c547befbd64861
3
+ size 640