Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- qwen3/__pycache__/predict_qwen3.cpython-313.pyc +0 -0
- qwen3/qwen3_0.5b.ini +124 -0
- qwen3/qwen3_decoder_cccc.bin +3 -0
- qwen3/tokenizer.json +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
qwen3/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
qwen3/__pycache__/predict_qwen3.cpython-313.pyc
ADDED
|
Binary file (10.6 kB). View file
|
|
|
qwen3/qwen3_0.5b.ini
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[train]
|
| 2 |
+
load_file = qwen3\qwen3_decoder_cccc.bin
|
| 3 |
+
load_net = 1
|
| 4 |
+
WorkType = 0
|
| 5 |
+
train_epochs = 0
|
| 6 |
+
Batch = 1
|
| 7 |
+
output_net = 1
|
| 8 |
+
gpu = 1
|
| 9 |
+
mp = 1
|
| 10 |
+
mp_device = 0
|
| 11 |
+
cifa = 1
|
| 12 |
+
named_weights = 1
|
| 13 |
+
|
| 14 |
+
[net]
|
| 15 |
+
cifa = 1
|
| 16 |
+
|
| 17 |
+
[cifa]
|
| 18 |
+
structure='
|
| 19 |
+
D = 1024;
|
| 20 |
+
Dq = 2048;
|
| 21 |
+
Dkv = 1024;
|
| 22 |
+
H = 16;
|
| 23 |
+
Hkv = 8;
|
| 24 |
+
hd = 128;
|
| 25 |
+
I = 3072;
|
| 26 |
+
V = 151936;
|
| 27 |
+
T = 512;
|
| 28 |
+
HB = 16;
|
| 29 |
+
HkvB = 8;
|
| 30 |
+
|
| 31 |
+
W_emb = Matrix(D, 1, 1, V);
|
| 32 |
+
setWeightName(W_emb, "W_emb");
|
| 33 |
+
token_ids = Matrix(T, 1, 1, 1);
|
| 34 |
+
X = embed(token_ids, W_emb);
|
| 35 |
+
|
| 36 |
+
cos_tab = ropeCosTbl(T, hd, 1000000.0);
|
| 37 |
+
sin_tab = ropeSinTbl(T, hd, 1000000.0);
|
| 38 |
+
|
| 39 |
+
for (i = 0; i < 28; i++)
|
| 40 |
+
{
|
| 41 |
+
W_rms_attn = Matrix(D, 1);
|
| 42 |
+
setWeightName(W_rms_attn, "W_rms_attn_" + to_string(i));
|
| 43 |
+
X_norm = rmsNorm(X, W_rms_attn);
|
| 44 |
+
|
| 45 |
+
W_q = Matrix(D, Dq, 1, 1);
|
| 46 |
+
setWeightName(W_q, "W_q_" + to_string(i));
|
| 47 |
+
Q_dq = batchedMul(W_q, X_norm, 1, 0);
|
| 48 |
+
Q_hHT = reshape(Q_dq, {hd, H, T, 1});
|
| 49 |
+
W_qnorm = Matrix(hd, 1);
|
| 50 |
+
setWeightName(W_qnorm, "W_qnorm_" + to_string(i));
|
| 51 |
+
Q_qnorm = rmsNorm(Q_hHT, W_qnorm);
|
| 52 |
+
Q_hTH = permute(Q_qnorm, {0, 2, 1, 3});
|
| 53 |
+
Q_hb = reshapeBatch(Q_hTH, {hd, T, 1, HB});
|
| 54 |
+
Q_r = rope(Q_hb, cos_tab, sin_tab);
|
| 55 |
+
|
| 56 |
+
W_k = Matrix(D, Dkv, 1, 1);
|
| 57 |
+
setWeightName(W_k, "W_k_" + to_string(i));
|
| 58 |
+
K_dkv = batchedMul(W_k, X_norm, 1, 0);
|
| 59 |
+
K_hHkvT = reshape(K_dkv, {hd, Hkv, T, 1});
|
| 60 |
+
W_knorm = Matrix(hd, 1);
|
| 61 |
+
setWeightName(W_knorm, "W_knorm_" + to_string(i));
|
| 62 |
+
K_knorm = rmsNorm(K_hHkvT, W_knorm);
|
| 63 |
+
K_hTHkv = permute(K_knorm, {0, 2, 1, 3});
|
| 64 |
+
K_hb = reshapeBatch(K_hTHkv, {hd, T, 1, HkvB});
|
| 65 |
+
K_r = rope(K_hb, cos_tab, sin_tab);
|
| 66 |
+
|
| 67 |
+
W_v = Matrix(D, Dkv, 1, 1);
|
| 68 |
+
setWeightName(W_v, "W_v_" + to_string(i));
|
| 69 |
+
V_dkv = batchedMul(W_v, X_norm, 1, 0);
|
| 70 |
+
V_hHkvT = reshape(V_dkv, {hd, Hkv, T, 1});
|
| 71 |
+
V_hTHkv = permute(V_hHkvT, {0, 2, 1, 3});
|
| 72 |
+
V_hb = reshapeBatch(V_hTHkv, {hd, T, 1, HkvB});
|
| 73 |
+
|
| 74 |
+
// GQA: standard repeat_kv grouping (Q head h uses K/V head h//2)
|
| 75 |
+
// Equivalent to: for each K/V head k, tile it groups=2 times consecutively
|
| 76 |
+
// Steps: reshapeBatch(Hkv→channel) + tile(number 1→groups) + permute(swap chan/num) + reshapeBatch
|
| 77 |
+
K_r2 = reshapeBatch(K_r, {hd, T, HkvB, 1});
|
| 78 |
+
K_r3 = tile(K_r2, {1, 1, 1, 2});
|
| 79 |
+
K_r4 = permute(K_r3, {0, 1, 3, 2});
|
| 80 |
+
K_tiled = reshapeBatch(K_r4, {hd, T, 1, HB});
|
| 81 |
+
|
| 82 |
+
V_r2 = reshapeBatch(V_hb, {hd, T, HkvB, 1});
|
| 83 |
+
V_r3 = tile(V_r2, {1, 1, 1, 2});
|
| 84 |
+
V_r4 = permute(V_r3, {0, 1, 3, 2});
|
| 85 |
+
V_tiled = reshapeBatch(V_r4, {hd, T, 1, HB});
|
| 86 |
+
|
| 87 |
+
Attn = attention(Q_r, K_tiled, V_tiled, hd, 1);
|
| 88 |
+
|
| 89 |
+
Attn_hTH = reshapeBatch(Attn, {hd, T, H, 1});
|
| 90 |
+
Attn_hHT = permute(Attn_hTH, {0, 2, 1, 3});
|
| 91 |
+
Attn_flat = reshape(Attn_hHT, {Dq, T, 1, 1});
|
| 92 |
+
W_o = Matrix(Dq, D, 1, 1);
|
| 93 |
+
setWeightName(W_o, "W_o_" + to_string(i));
|
| 94 |
+
O_out = batchedMul(W_o, Attn_flat, 1, 0);
|
| 95 |
+
|
| 96 |
+
R1 = X + O_out;
|
| 97 |
+
|
| 98 |
+
W_rms_ffn = Matrix(D, 1);
|
| 99 |
+
setWeightName(W_rms_ffn, "W_rms_ffn_" + to_string(i));
|
| 100 |
+
R1_norm = rmsNorm(R1, W_rms_ffn);
|
| 101 |
+
|
| 102 |
+
W_gate = Matrix(D, I, 1, 1);
|
| 103 |
+
setWeightName(W_gate, "W_gate_" + to_string(i));
|
| 104 |
+
W_up = Matrix(D, I, 1, 1);
|
| 105 |
+
setWeightName(W_up, "W_up_" + to_string(i));
|
| 106 |
+
gate_out = silu(batchedMul(W_gate, R1_norm, 1, 0));
|
| 107 |
+
up_out = batchedMul(W_up, R1_norm, 1, 0);
|
| 108 |
+
gated = elementMul(gate_out, up_out);
|
| 109 |
+
W_down = Matrix(I, D, 1, 1);
|
| 110 |
+
setWeightName(W_down, "W_down_" + to_string(i));
|
| 111 |
+
ffn_out = batchedMul(W_down, gated, 1, 0);
|
| 112 |
+
|
| 113 |
+
X = R1 + ffn_out;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
W_rms_final = Matrix(D, 1);
|
| 117 |
+
setWeightName(W_rms_final, "W_rms_final");
|
| 118 |
+
X_final = rmsNorm(X, W_rms_final);
|
| 119 |
+
W_lm_head = Matrix(D, V, 1, 1);
|
| 120 |
+
setWeightName(W_lm_head, "W_lm_head");
|
| 121 |
+
logits = batchedMul(W_lm_head, X_final, 1, 0);
|
| 122 |
+
|
| 123 |
+
setXY(token_ids, logits);
|
| 124 |
+
'
|
qwen3/qwen3_decoder_cccc.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:43efb535cfff9bfab19705aba4650df58a9d3b0b6975e6270d68ad0cd504945a
|
| 3 |
+
size 3006540214
|
qwen3/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
|
| 3 |
+
size 11422654
|