Download weights/instances/i4a486d70/model_spec.json from Boom5426/WeightCode: direct link, hf CLI and curl.
- Browser
- Download file 16.9 kB
-
https://huggingface.co/datasets/Boom5426/WeightCode/resolve/main/weights/instances/i4a486d70/model_spec.json
- Command line
-
hf download hf://datasets/Boom5426/WeightCode/weights/instances/i4a486d70/model_spec.json
-
curl -L -o model_spec.json https://huggingface.co/datasets/Boom5426/WeightCode/resolve/main/weights/instances/i4a486d70/model_spec.json
16.9 kB
| { | |
| "schema": "wrsi.model_spec.vit_lite.v1", | |
| "model_id": "mbd1318b8", | |
| "arch": "vit_lite_7_4", | |
| "input": { | |
| "kind": "images", | |
| "shape": [ | |
| 3, | |
| 32, | |
| 32 | |
| ], | |
| "dtype": "uint8", | |
| "layout": "NCHW" | |
| }, | |
| "input_shape": [ | |
| 3, | |
| 32, | |
| 32 | |
| ], | |
| "preprocessing": { | |
| "mean": [ | |
| 0.490903318493413, | |
| 0.4817690980200674, | |
| 0.4460368943397672 | |
| ], | |
| "std": [ | |
| 0.24706968464047946, | |
| 0.24352667019453098, | |
| 0.26164691226372544 | |
| ], | |
| "computes": "x / 255, then per channel (x - mean[c]) / std[c]" | |
| }, | |
| "classes": [ | |
| "airplane", | |
| "automobile", | |
| "bird", | |
| "cat", | |
| "deer", | |
| "dog", | |
| "frog", | |
| "horse", | |
| "ship", | |
| "truck" | |
| ], | |
| "n_classes": 10, | |
| "layernorm": { | |
| "eps": 1e-05, | |
| "computes": "(a - mean) / sqrt(var + eps) * weight + bias over the last axis, biased variance" | |
| }, | |
| "gelu": "tanh form: 0.5 * a * (1 + tanh(sqrt(2 / pi) * (a + 0.044715 * a^3)))", | |
| "parameter_layout": "PyTorch: linear weight [out, in]; patch projection weight [dim, channels, patch, patch]; class_emb [1, 1, dim]; positional_emb [1, tokens, dim]; LayerNorm weight and bias [dim]; all float32", | |
| "n_parameters": 3716874, | |
| "tensors": { | |
| "tokenizer.conv_layers.0.0.weight": [ | |
| 256, | |
| 3, | |
| 4, | |
| 4 | |
| ], | |
| "tokenizer.conv_layers.0.0.bias": [ | |
| 256 | |
| ], | |
| "classifier.class_emb": [ | |
| 1, | |
| 1, | |
| 256 | |
| ], | |
| "classifier.positional_emb": [ | |
| 1, | |
| 65, | |
| 256 | |
| ], | |
| "classifier.blocks.0.pre_norm.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.0.pre_norm.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.0.self_attn.qkv.weight": [ | |
| 768, | |
| 256 | |
| ], | |
| "classifier.blocks.0.self_attn.proj.weight": [ | |
| 256, | |
| 256 | |
| ], | |
| "classifier.blocks.0.self_attn.proj.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.0.linear1.weight": [ | |
| 512, | |
| 256 | |
| ], | |
| "classifier.blocks.0.linear1.bias": [ | |
| 512 | |
| ], | |
| "classifier.blocks.0.norm1.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.0.norm1.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.0.linear2.weight": [ | |
| 256, | |
| 512 | |
| ], | |
| "classifier.blocks.0.linear2.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.1.pre_norm.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.1.pre_norm.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.1.self_attn.qkv.weight": [ | |
| 768, | |
| 256 | |
| ], | |
| "classifier.blocks.1.self_attn.proj.weight": [ | |
| 256, | |
| 256 | |
| ], | |
| "classifier.blocks.1.self_attn.proj.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.1.linear1.weight": [ | |
| 512, | |
| 256 | |
| ], | |
| "classifier.blocks.1.linear1.bias": [ | |
| 512 | |
| ], | |
| "classifier.blocks.1.norm1.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.1.norm1.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.1.linear2.weight": [ | |
| 256, | |
| 512 | |
| ], | |
| "classifier.blocks.1.linear2.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.2.pre_norm.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.2.pre_norm.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.2.self_attn.qkv.weight": [ | |
| 768, | |
| 256 | |
| ], | |
| "classifier.blocks.2.self_attn.proj.weight": [ | |
| 256, | |
| 256 | |
| ], | |
| "classifier.blocks.2.self_attn.proj.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.2.linear1.weight": [ | |
| 512, | |
| 256 | |
| ], | |
| "classifier.blocks.2.linear1.bias": [ | |
| 512 | |
| ], | |
| "classifier.blocks.2.norm1.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.2.norm1.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.2.linear2.weight": [ | |
| 256, | |
| 512 | |
| ], | |
| "classifier.blocks.2.linear2.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.3.pre_norm.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.3.pre_norm.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.3.self_attn.qkv.weight": [ | |
| 768, | |
| 256 | |
| ], | |
| "classifier.blocks.3.self_attn.proj.weight": [ | |
| 256, | |
| 256 | |
| ], | |
| "classifier.blocks.3.self_attn.proj.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.3.linear1.weight": [ | |
| 512, | |
| 256 | |
| ], | |
| "classifier.blocks.3.linear1.bias": [ | |
| 512 | |
| ], | |
| "classifier.blocks.3.norm1.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.3.norm1.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.3.linear2.weight": [ | |
| 256, | |
| 512 | |
| ], | |
| "classifier.blocks.3.linear2.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.4.pre_norm.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.4.pre_norm.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.4.self_attn.qkv.weight": [ | |
| 768, | |
| 256 | |
| ], | |
| "classifier.blocks.4.self_attn.proj.weight": [ | |
| 256, | |
| 256 | |
| ], | |
| "classifier.blocks.4.self_attn.proj.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.4.linear1.weight": [ | |
| 512, | |
| 256 | |
| ], | |
| "classifier.blocks.4.linear1.bias": [ | |
| 512 | |
| ], | |
| "classifier.blocks.4.norm1.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.4.norm1.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.4.linear2.weight": [ | |
| 256, | |
| 512 | |
| ], | |
| "classifier.blocks.4.linear2.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.5.pre_norm.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.5.pre_norm.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.5.self_attn.qkv.weight": [ | |
| 768, | |
| 256 | |
| ], | |
| "classifier.blocks.5.self_attn.proj.weight": [ | |
| 256, | |
| 256 | |
| ], | |
| "classifier.blocks.5.self_attn.proj.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.5.linear1.weight": [ | |
| 512, | |
| 256 | |
| ], | |
| "classifier.blocks.5.linear1.bias": [ | |
| 512 | |
| ], | |
| "classifier.blocks.5.norm1.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.5.norm1.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.5.linear2.weight": [ | |
| 256, | |
| 512 | |
| ], | |
| "classifier.blocks.5.linear2.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.6.pre_norm.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.6.pre_norm.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.6.self_attn.qkv.weight": [ | |
| 768, | |
| 256 | |
| ], | |
| "classifier.blocks.6.self_attn.proj.weight": [ | |
| 256, | |
| 256 | |
| ], | |
| "classifier.blocks.6.self_attn.proj.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.6.linear1.weight": [ | |
| 512, | |
| 256 | |
| ], | |
| "classifier.blocks.6.linear1.bias": [ | |
| 512 | |
| ], | |
| "classifier.blocks.6.norm1.weight": [ | |
| 256 | |
| ], | |
| "classifier.blocks.6.norm1.bias": [ | |
| 256 | |
| ], | |
| "classifier.blocks.6.linear2.weight": [ | |
| 256, | |
| 512 | |
| ], | |
| "classifier.blocks.6.linear2.bias": [ | |
| 256 | |
| ], | |
| "classifier.norm.weight": [ | |
| 256 | |
| ], | |
| "classifier.norm.bias": [ | |
| 256 | |
| ], | |
| "classifier.fc.weight": [ | |
| 10, | |
| 256 | |
| ], | |
| "classifier.fc.bias": [ | |
| 10 | |
| ] | |
| }, | |
| "layers": [ | |
| { | |
| "name": "tokenizer.conv_layers.0.0", | |
| "op": "patch_projection", | |
| "weight": "tokenizer.conv_layers.0.0.weight", | |
| "bias": "tokenizer.conv_layers.0.0.bias", | |
| "patch": 4, | |
| "n_patches": 64, | |
| "computes": "tokens[n, p] = patch_p(x[n]).flatten() @ weight.reshape(dim, -1).T + bias for the 64 non-overlapping 4 x 4 patches in row-major grid order, each flattened as (channel, row, column); equal to conv2d with kernel and stride patch, no padding" | |
| }, | |
| { | |
| "name": "embed", | |
| "op": "class_token_and_positions", | |
| "class_token": "classifier.class_emb", | |
| "positions": "classifier.positional_emb", | |
| "computes": "h = concat([class_emb, tokens], token axis) + positional_emb; token 0 is the class token" | |
| }, | |
| { | |
| "name": "classifier.blocks.0", | |
| "op": "transformer_layer", | |
| "heads": 4, | |
| "head_dim": 64, | |
| "mlp_hidden": 512, | |
| "pre_norm": { | |
| "weight": "classifier.blocks.0.pre_norm.weight", | |
| "bias": "classifier.blocks.0.pre_norm.bias" | |
| }, | |
| "qkv": { | |
| "weight": "classifier.blocks.0.self_attn.qkv.weight", | |
| "bias": null, | |
| "rows": "q = rows 0..255, k = rows 256..511, v = rows 512..767; head j uses columns j*64 .. (j+1)*64 - 1 of each" | |
| }, | |
| "proj": { | |
| "weight": "classifier.blocks.0.self_attn.proj.weight", | |
| "bias": "classifier.blocks.0.self_attn.proj.bias" | |
| }, | |
| "norm1": { | |
| "weight": "classifier.blocks.0.norm1.weight", | |
| "bias": "classifier.blocks.0.norm1.bias" | |
| }, | |
| "linear1": { | |
| "weight": "classifier.blocks.0.linear1.weight", | |
| "bias": "classifier.blocks.0.linear1.bias" | |
| }, | |
| "linear2": { | |
| "weight": "classifier.blocks.0.linear2.weight", | |
| "bias": "classifier.blocks.0.linear2.bias" | |
| }, | |
| "computes": "h = h + proj(attention(pre_norm(h))); h = norm1(h); h = h + linear2(gelu(linear1(h))); attention per head = softmax(q k^T / sqrt(head_dim)) v over all tokens" | |
| }, | |
| { | |
| "name": "classifier.blocks.1", | |
| "op": "transformer_layer", | |
| "heads": 4, | |
| "head_dim": 64, | |
| "mlp_hidden": 512, | |
| "pre_norm": { | |
| "weight": "classifier.blocks.1.pre_norm.weight", | |
| "bias": "classifier.blocks.1.pre_norm.bias" | |
| }, | |
| "qkv": { | |
| "weight": "classifier.blocks.1.self_attn.qkv.weight", | |
| "bias": null, | |
| "rows": "q = rows 0..255, k = rows 256..511, v = rows 512..767; head j uses columns j*64 .. (j+1)*64 - 1 of each" | |
| }, | |
| "proj": { | |
| "weight": "classifier.blocks.1.self_attn.proj.weight", | |
| "bias": "classifier.blocks.1.self_attn.proj.bias" | |
| }, | |
| "norm1": { | |
| "weight": "classifier.blocks.1.norm1.weight", | |
| "bias": "classifier.blocks.1.norm1.bias" | |
| }, | |
| "linear1": { | |
| "weight": "classifier.blocks.1.linear1.weight", | |
| "bias": "classifier.blocks.1.linear1.bias" | |
| }, | |
| "linear2": { | |
| "weight": "classifier.blocks.1.linear2.weight", | |
| "bias": "classifier.blocks.1.linear2.bias" | |
| }, | |
| "computes": "h = h + proj(attention(pre_norm(h))); h = norm1(h); h = h + linear2(gelu(linear1(h))); attention per head = softmax(q k^T / sqrt(head_dim)) v over all tokens" | |
| }, | |
| { | |
| "name": "classifier.blocks.2", | |
| "op": "transformer_layer", | |
| "heads": 4, | |
| "head_dim": 64, | |
| "mlp_hidden": 512, | |
| "pre_norm": { | |
| "weight": "classifier.blocks.2.pre_norm.weight", | |
| "bias": "classifier.blocks.2.pre_norm.bias" | |
| }, | |
| "qkv": { | |
| "weight": "classifier.blocks.2.self_attn.qkv.weight", | |
| "bias": null, | |
| "rows": "q = rows 0..255, k = rows 256..511, v = rows 512..767; head j uses columns j*64 .. (j+1)*64 - 1 of each" | |
| }, | |
| "proj": { | |
| "weight": "classifier.blocks.2.self_attn.proj.weight", | |
| "bias": "classifier.blocks.2.self_attn.proj.bias" | |
| }, | |
| "norm1": { | |
| "weight": "classifier.blocks.2.norm1.weight", | |
| "bias": "classifier.blocks.2.norm1.bias" | |
| }, | |
| "linear1": { | |
| "weight": "classifier.blocks.2.linear1.weight", | |
| "bias": "classifier.blocks.2.linear1.bias" | |
| }, | |
| "linear2": { | |
| "weight": "classifier.blocks.2.linear2.weight", | |
| "bias": "classifier.blocks.2.linear2.bias" | |
| }, | |
| "computes": "h = h + proj(attention(pre_norm(h))); h = norm1(h); h = h + linear2(gelu(linear1(h))); attention per head = softmax(q k^T / sqrt(head_dim)) v over all tokens" | |
| }, | |
| { | |
| "name": "classifier.blocks.3", | |
| "op": "transformer_layer", | |
| "heads": 4, | |
| "head_dim": 64, | |
| "mlp_hidden": 512, | |
| "pre_norm": { | |
| "weight": "classifier.blocks.3.pre_norm.weight", | |
| "bias": "classifier.blocks.3.pre_norm.bias" | |
| }, | |
| "qkv": { | |
| "weight": "classifier.blocks.3.self_attn.qkv.weight", | |
| "bias": null, | |
| "rows": "q = rows 0..255, k = rows 256..511, v = rows 512..767; head j uses columns j*64 .. (j+1)*64 - 1 of each" | |
| }, | |
| "proj": { | |
| "weight": "classifier.blocks.3.self_attn.proj.weight", | |
| "bias": "classifier.blocks.3.self_attn.proj.bias" | |
| }, | |
| "norm1": { | |
| "weight": "classifier.blocks.3.norm1.weight", | |
| "bias": "classifier.blocks.3.norm1.bias" | |
| }, | |
| "linear1": { | |
| "weight": "classifier.blocks.3.linear1.weight", | |
| "bias": "classifier.blocks.3.linear1.bias" | |
| }, | |
| "linear2": { | |
| "weight": "classifier.blocks.3.linear2.weight", | |
| "bias": "classifier.blocks.3.linear2.bias" | |
| }, | |
| "computes": "h = h + proj(attention(pre_norm(h))); h = norm1(h); h = h + linear2(gelu(linear1(h))); attention per head = softmax(q k^T / sqrt(head_dim)) v over all tokens" | |
| }, | |
| { | |
| "name": "classifier.blocks.4", | |
| "op": "transformer_layer", | |
| "heads": 4, | |
| "head_dim": 64, | |
| "mlp_hidden": 512, | |
| "pre_norm": { | |
| "weight": "classifier.blocks.4.pre_norm.weight", | |
| "bias": "classifier.blocks.4.pre_norm.bias" | |
| }, | |
| "qkv": { | |
| "weight": "classifier.blocks.4.self_attn.qkv.weight", | |
| "bias": null, | |
| "rows": "q = rows 0..255, k = rows 256..511, v = rows 512..767; head j uses columns j*64 .. (j+1)*64 - 1 of each" | |
| }, | |
| "proj": { | |
| "weight": "classifier.blocks.4.self_attn.proj.weight", | |
| "bias": "classifier.blocks.4.self_attn.proj.bias" | |
| }, | |
| "norm1": { | |
| "weight": "classifier.blocks.4.norm1.weight", | |
| "bias": "classifier.blocks.4.norm1.bias" | |
| }, | |
| "linear1": { | |
| "weight": "classifier.blocks.4.linear1.weight", | |
| "bias": "classifier.blocks.4.linear1.bias" | |
| }, | |
| "linear2": { | |
| "weight": "classifier.blocks.4.linear2.weight", | |
| "bias": "classifier.blocks.4.linear2.bias" | |
| }, | |
| "computes": "h = h + proj(attention(pre_norm(h))); h = norm1(h); h = h + linear2(gelu(linear1(h))); attention per head = softmax(q k^T / sqrt(head_dim)) v over all tokens" | |
| }, | |
| { | |
| "name": "classifier.blocks.5", | |
| "op": "transformer_layer", | |
| "heads": 4, | |
| "head_dim": 64, | |
| "mlp_hidden": 512, | |
| "pre_norm": { | |
| "weight": "classifier.blocks.5.pre_norm.weight", | |
| "bias": "classifier.blocks.5.pre_norm.bias" | |
| }, | |
| "qkv": { | |
| "weight": "classifier.blocks.5.self_attn.qkv.weight", | |
| "bias": null, | |
| "rows": "q = rows 0..255, k = rows 256..511, v = rows 512..767; head j uses columns j*64 .. (j+1)*64 - 1 of each" | |
| }, | |
| "proj": { | |
| "weight": "classifier.blocks.5.self_attn.proj.weight", | |
| "bias": "classifier.blocks.5.self_attn.proj.bias" | |
| }, | |
| "norm1": { | |
| "weight": "classifier.blocks.5.norm1.weight", | |
| "bias": "classifier.blocks.5.norm1.bias" | |
| }, | |
| "linear1": { | |
| "weight": "classifier.blocks.5.linear1.weight", | |
| "bias": "classifier.blocks.5.linear1.bias" | |
| }, | |
| "linear2": { | |
| "weight": "classifier.blocks.5.linear2.weight", | |
| "bias": "classifier.blocks.5.linear2.bias" | |
| }, | |
| "computes": "h = h + proj(attention(pre_norm(h))); h = norm1(h); h = h + linear2(gelu(linear1(h))); attention per head = softmax(q k^T / sqrt(head_dim)) v over all tokens" | |
| }, | |
| { | |
| "name": "classifier.blocks.6", | |
| "op": "transformer_layer", | |
| "heads": 4, | |
| "head_dim": 64, | |
| "mlp_hidden": 512, | |
| "pre_norm": { | |
| "weight": "classifier.blocks.6.pre_norm.weight", | |
| "bias": "classifier.blocks.6.pre_norm.bias" | |
| }, | |
| "qkv": { | |
| "weight": "classifier.blocks.6.self_attn.qkv.weight", | |
| "bias": null, | |
| "rows": "q = rows 0..255, k = rows 256..511, v = rows 512..767; head j uses columns j*64 .. (j+1)*64 - 1 of each" | |
| }, | |
| "proj": { | |
| "weight": "classifier.blocks.6.self_attn.proj.weight", | |
| "bias": "classifier.blocks.6.self_attn.proj.bias" | |
| }, | |
| "norm1": { | |
| "weight": "classifier.blocks.6.norm1.weight", | |
| "bias": "classifier.blocks.6.norm1.bias" | |
| }, | |
| "linear1": { | |
| "weight": "classifier.blocks.6.linear1.weight", | |
| "bias": "classifier.blocks.6.linear1.bias" | |
| }, | |
| "linear2": { | |
| "weight": "classifier.blocks.6.linear2.weight", | |
| "bias": "classifier.blocks.6.linear2.bias" | |
| }, | |
| "computes": "h = h + proj(attention(pre_norm(h))); h = norm1(h); h = h + linear2(gelu(linear1(h))); attention per head = softmax(q k^T / sqrt(head_dim)) v over all tokens" | |
| }, | |
| { | |
| "name": "classifier.norm", | |
| "op": "layernorm", | |
| "weight": "classifier.norm.weight", | |
| "bias": "classifier.norm.bias", | |
| "computes": "features f = norm(h)[:, 0], the class token's row" | |
| }, | |
| { | |
| "name": "classifier.fc", | |
| "op": "linear", | |
| "weight": "classifier.fc.weight", | |
| "bias": "classifier.fc.bias", | |
| "shape": [ | |
| 10, | |
| 256 | |
| ], | |
| "computes": "logits = f @ weight.T + bias" | |
| } | |
| ], | |
| "output": "logits [N, n_classes]; the prediction is the argmax", | |
| "reference_forward": "forward.py: forward(params, x_uint8 [N, 3, 32, 32]) -> float32 logits [N, n_classes]" | |
| } | |