Dsg2 commited on
Commit
960d202
·
0 Parent(s):

Duplicate from Dsg2/LS-Micro-Base

Browse files
.gitattributes ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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
+ LS-Micro-Base-Checkpoint/LS-Micro-Base.bin.opt.ng filter=lfs diff=lfs merge=lfs -text
37
+ LS-Micro-Base-Checkpoint/LS-Micro-Base.bin.opt.q filter=lfs diff=lfs merge=lfs -text
LS-Micro-Base-Checkpoint/LS-Micro-Base.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72321fc00c03831c83673c79dbefde1d26be43a45ce56d247dbf49d0a92cdc66
3
+ size 29474320
LS-Micro-Base-Checkpoint/LS-Micro-Base.bin.env ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # cudalm model config (written by new/train). KEY=VALUE; the environment overrides these.
2
+ CUDALM_BENCH_EVERY=0
3
+ CUDALM_BENCH_N=0
4
+ CUDALM_QLM=1
5
+ CUDALM_ATTN_GATE=0
6
+ CUDALM_TOPK=1
7
+ CUDALM_UNIPOOL=0
8
+ NGRAM_Q4_FOLD=1
9
+ CUDALM_NGRAM=1
10
+ CUDALM_ENGRAM=0
11
+ NGRAM_ROWS=131072
12
+ NGRAM_DIM=32
13
+ NGRAM_Q4=1
14
+ NGRAM_GATE=1
15
+ NGRAM_LAYER=0
16
+ NGRAM_ORDER=2
17
+ NGRAM_TRI=0
LS-Micro-Base-Checkpoint/LS-Micro-Base.bin.opt.ng ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:14114027d057cbab5a7b19a35ca96954d7497aad2c559ee0ed1b994309d5a62b
3
+ size 15122460
LS-Micro-Base-Checkpoint/LS-Micro-Base.bin.opt.q ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:abd18fc908e8adb1961c99249c25b4c5a13b3214d621d14bd929c4724a0f5af5
3
+ size 27439924
LS-Micro-Base-Checkpoint/LS-Micro-Base.bin.opt.t1 ADDED
Binary file (49.2 kB). View file
 
README.md ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ pipeline_tag: text-generation
6
+ ---
7
+
8
+ This repo contains the Base (completed pretrain cudalm checkpoint) variant of LS-Micro. The FP32 checkpoint and optimiser is provided, and can be used by tinylm chat.
9
+ - Model size: 28.1MB (FP32)
10
+ - Cudalm QLM optimiser: 26.1MB
11
+ - Ngrams container: 14.4MB
12
+ - T1 sidecar: 48KB
13
+ - Environment vars: 295B
14
+
15
+ # LS-Micro: Smallest and fastest model in the LS family.
16
+
17
+ | | HellaSwag | ARC-E | ARC-C | PIQA | LAMBADA | ArithMark | II* |
18
+ | ------------- | --------- | ----- | ----- | -------- | ------- | --------- | ---- |
19
+ | LS-Micro-Base | 27.41 | 34.72 | 21.93 | 54.84 | 11.06 | 35.50 | 7.24 |
20
+ | LS-Tiny-Base | 27.11 | 32.24 | 24.49 | 53.81 | 2.99 | 34.00 | 6.22 |
21
+
22
+ LS-Micro is 3x smaller than LS-TIny (11M vs 31M), and has 3x less active parameters (5M vs 15M), yet has a 16% higher intelligence index.
23
+
24
+ \* Intelligence Index was calculated using the formula from [Open SLM Leaderboard](https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard). (*Results reproducable via Cudalm's built in bench tool, see bottom quickstart*)
25
+
26
+ Pushing the limits of size to quality, LS-Micro-Base is a sparse 11.49M MoE model (A5.52M) pretrained on 5.7B tokens.
27
+ Training at a speed of 255.6k tokens/s on a 5060ti 16GB, it offers an incredible training efficiency at ~2.9x faster tokens seen compared to LS2.5's 108M-A17M model.
28
+ Fully pretrained in ~6 hours.
29
+
30
+ | **Model specs** | |
31
+ |----------------------|--------|
32
+ | Total parameters: | 11.49M |
33
+ | Backbone: | 7.28M |
34
+ | Active: | 5.52M |
35
+ | Ngrams: | 4.21M |
36
+ | Context length: | 2048 |
37
+ | **Pretrain details** | |
38
+ | Tokens seen: | ~5.7B |
39
+ | GPU time (5060ti): | 22310s |
40
+
41
+ *Note that it was trained with a 16k vocab, so 3.15M of the 5.52M active parameters are embedding.
42
+
43
+ ## Chatbench results:
44
+
45
+ Multiple choice:
46
+ | category | n | acc | accnorm | chance |
47
+ | ------------- | --- | --------- | ----------- | ------ |
48
+ | fact | 25 | 48.0% | 60.0% | 25.0% |
49
+ | commonsense | 20 | 65.0% | 55.0% | 25.0% |
50
+ | instruct | 20 | 55.0% | 50.0% | 25.0% |
51
+ | relevance | 20 | 5.0% | 30.0% | 25.0% |
52
+ | consistency | 18 | 61.1% | 72.2% | 25.0% |
53
+ | arithmetic | 15 | 46.7% | 46.7% | 25.0% |
54
+ | LS-Micro-Base | 118 | **46.6%** | **52.5%** | 25.0% |
55
+ | LS-Tiny-Base | 118 | 40.7% | 47.5% | 25.0% |
56
+
57
+ Example: (Greedy)
58
+ ```
59
+ <|user|>
60
+ Hi
61
+ <|assistant|>
62
+ I'm sorry, but I'm unable to assist with the problem. My current capabilities are limited to the functions provided to me. In this case, I can help you solve the problem.
63
+ ```
64
+
65
+ ## The base model is horrendous at chat, and is intended to be used as a base to be finetuned for specialised tasks.
66
+ To try LS-Micro or to train/finetune the model, follow this quickstart guide:
67
+ 1. Clone the latest version of Cudalm [here](https://github.com/Dsg2/cudalm-c) (only windows supported currently, optimised for Blackwell 2.0/CPU).
68
+ 2. Build with `build.py`/`build.py` --cpu'. Run cudalm to init all folders.
69
+ 3. Download all LS-Micro files from `LS-Micro-Base-Checkpoint\` and drop them in `<cudalm.exe>\models\`. Cudalm then automatically detects the model.
70
+
71
+ Voila, you can now start experimenting with the model. Some basic stuff you can try first:
72
+
73
+ - Check the model's config, and settings used to train it. `> Model info`
74
+ - Run the model: `> Generate`
75
+
76
+ ## Finetune guide:
77
+ To finetune the model, you first need to prepare some data.
78
+
79
+ Navigate to `> Data tools...`. You can download preconfigured mixtures of data, use files on your system or nitpick your own datasets.
80
+ - To use a preset corpus, navigate into `> Data tools... > Download text`.
81
+ - Otherwise, find a dataset on hugginface and navigate to `> Data tools... > Browse Hugging Face`, and pick out your chosen dataset from there. Note that datasets with gated access requires your `HF_TOKEN` to be set.
82
+
83
+ This guide will use the dataset [MiniCPM5-2B-distill](https://huggingface.co/datasets/Dsg2/MiniCPM5-2B-distill) as an example. For your own text or other datasets, simply select the folder while tokenizing.
84
+
85
+ Navigate to `> Data tools... > Browse Hugging Face`, and search for "MiniCPM5-2B-distill". Cudalm automatically detects the format, so all you need to do is download it (~250MB).
86
+
87
+ Then you will need to tokenize the text so that the model can be trained on it. To do this, you will need a trained tokenizer. Luckily, you can extract an existing model's tokenizer. Use `> Data tools... > Tokenizer from model` and pull out LS-Micro-Base's tokenizer.
88
+
89
+ Now you can tokenize your data. Go to `> Data tools... > Build corpus` and set `mode` to "new" and give it a corpus name. For your own datasets or text, navigate to the folder the text files are in. Otherwise, select `<cudalm.exe>\data\hf_MiniCPM5-2B-distill`, then use the extracted tokenizer and select `Run`. It should take ~10s and produce `<cudalm.exe>\data\<corpus name>`
90
+
91
+ You're now ready to start fine tuning!
92
+
93
+ Go to `> Train` and select "LS-Micro-Base" as the model, and the tokenized corpus as the data directory (both auto-detected). Select Run to start training the model on the selected corpus. Progress prints and periodic saves will occur every few hundred iters.