Upload base_final
Browse files- README.md +19 -20
- assets/loops.png +0 -0
- model.safetensors +1 -1
- onnx/coda.onnx +1 -1
- onnx/core.onnx +1 -1
- onnx/prelude.onnx +1 -1
- onnx/stem.onnx +1 -1
README.md
CHANGED
|
@@ -26,9 +26,7 @@ datasets:
|
|
| 26 |
|
| 27 |
# loopmm base
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
loopmm is a small language model that takes images and text as input. It has 189M parameters. Its 12 middle layers run three times for each token. It was trained from scratch on 9.3B tokens of text and image-text data.
|
| 32 |
|
| 33 |
This repo holds the pretrained base model. It continues text and writes captions for images, but it does not follow instructions. A chat version will be published later today.
|
| 34 |
|
|
@@ -47,7 +45,7 @@ loopmm uses the LFM3 layer layout, but it is not a Liquid AI model. It contains
|
|
| 47 |
|
| 48 |
## Training data
|
| 49 |
|
| 50 |
-
The model saw
|
| 51 |
|
| 52 |
Text-only data:
|
| 53 |
- Web: [Ultra-FineWeb](https://huggingface.co/datasets/openbmb/Ultra-FineWeb) (English) and [DCLM baseline](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0)
|
|
@@ -65,29 +63,30 @@ Image-text data:
|
|
| 65 |
|
| 66 |
## Training
|
| 67 |
|
| 68 |
-
-
|
| 69 |
-
- Phases. 7.9B tokens at a context of 4,096 with a flat learning rate
|
|
|
|
| 70 |
- Optimizer. Muon for the matrices inside the layers, and AdamW for the embedding, the image stem, the norms, the conv kernels, the AttnRes queries and the gate. Peak learning rate 2e-3, weight decay 0.1, gradient clipping at 1.0, bf16.
|
| 71 |
-
- Hardware. One node of 8 B200 GPUs on Modal for about 2
|
| 72 |
|
| 73 |
## Results
|
| 74 |
|
| 75 |
-
Validation loss
|
| 76 |
|
| 77 |
## Loop count
|
| 78 |
|
| 79 |
-
The model was trained with 3 passes through the core, but it can run with any number. The table shows the validation loss
|
| 80 |
|
| 81 |
| loops | text | caption | caption, no image |
|
| 82 |
|---|---|---|---|
|
| 83 |
-
| 1 | 3.
|
| 84 |
-
| 2 | 3.
|
| 85 |
-
| 3 | 2.
|
| 86 |
-
| 4 | 2.
|
| 87 |
-
| 5 | 2.
|
| 88 |
-
| 6 | 2.
|
| 89 |
|
| 90 |
-
One pass costs 0.
|
| 91 |
|
| 92 |

|
| 93 |
|
|
@@ -132,7 +131,7 @@ print(model.complete(tok, "The best way to learn a new language is", max_new_tok
|
|
| 132 |
|
| 133 |
`model(input_ids)` returns logits for every position. Generation goes through `complete()` and `generate_from()`, which keep a cache, so each new token costs one step. `transformers`' own `generate()` is not supported. Put token id 1 (`<|startoftext|>`) before your text; `complete()` does this for you.
|
| 134 |
|
| 135 |
-
The release code gives the same logits as the training code (largest difference
|
| 136 |
|
| 137 |
### ONNX
|
| 138 |
|
|
@@ -143,15 +142,15 @@ The release code gives the same logits as the training code (largest difference
|
|
| 143 |
- `core.onnx`: layers 6 to 17. Run it once per loop, and keep a separate cache for each loop.
|
| 144 |
- `coda.onnx`: layers 18 to 23 and the output head
|
| 145 |
|
| 146 |
-
`onnx/meta.json` lists the inputs of each graph. The `engine.js` file of the Space shows how to call them. The weights are stored in fp16 and computed in fp32, so the ONNX graphs give the same results as PyTorch: on validation text the loss is 3.
|
| 147 |
|
| 148 |
## Limitations
|
| 149 |
|
| 150 |
-
- It is a small model, and it was trained on only
|
| 151 |
- It is a base model with no instruction tuning and no safety tuning.
|
| 152 |
- Most of the training data is in English.
|
| 153 |
- Its image skills are basic. Its captions name the main content of a photo, but they often get details, counts and text in the image wrong.
|
| 154 |
-
-
|
| 155 |
|
| 156 |
## Licenses
|
| 157 |
|
|
|
|
| 26 |
|
| 27 |
# loopmm base
|
| 28 |
|
| 29 |
+
loopmm is a small language model that takes images and text as input. It has 189M parameters. Its 12 middle layers run three times for each token. It was trained from scratch on 8.74B tokens of text and image-text data.
|
|
|
|
|
|
|
| 30 |
|
| 31 |
This repo holds the pretrained base model. It continues text and writes captions for images, but it does not follow instructions. A chat version will be published later today.
|
| 32 |
|
|
|
|
| 45 |
|
| 46 |
## Training data
|
| 47 |
|
| 48 |
+
The model saw 8.74B tokens. About half of them come from text-only documents and half from documents with images. About a quarter of all tokens are image patches. The loss is computed on text tokens only.
|
| 49 |
|
| 50 |
Text-only data:
|
| 51 |
- Web: [Ultra-FineWeb](https://huggingface.co/datasets/openbmb/Ultra-FineWeb) (English) and [DCLM baseline](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0)
|
|
|
|
| 63 |
|
| 64 |
## Training
|
| 65 |
|
| 66 |
+
- 8.74B tokens, 2^20 (about 1M) tokens per step.
|
| 67 |
+
- Phases. 7.9B tokens at a context of 4,096 with a flat learning rate, after a 1,000-step warmup. Then 0.84B tokens at 4k on higher-quality data, while the learning rate decays from 2e-3 to 4.7e-4.
|
| 68 |
+
- The plan had two more phases, 0.42B tokens at 32k and 0.14B at 64k, in which the learning rate would reach 0. The run hit its budget limit after a crash at the start of the 32k phase, so these weights are the checkpoint from the end of the 4k phases (step 8,337).
|
| 69 |
- Optimizer. Muon for the matrices inside the layers, and AdamW for the embedding, the image stem, the norms, the conv kernels, the AttnRes queries and the gate. Peak learning rate 2e-3, weight decay 0.1, gradient clipping at 1.0, bf16.
|
| 70 |
+
- Hardware. One node of 8 B200 GPUs on Modal, for about 2 hours of training.
|
| 71 |
|
| 72 |
## Results
|
| 73 |
|
| 74 |
+
Validation loss of the final weights (3 loops): 2.859 on Ultra-FineWeb text. On DOCCI image descriptions it is 2.267 with the image and 2.568 without it, so the model uses the image. Benchmark results will be added here later today.
|
| 75 |
|
| 76 |
## Loop count
|
| 77 |
|
| 78 |
+
The model was trained with 3 passes through the core, but it can run with any number. The table shows the validation loss of the final weights at each loop count. Text is 8,192 tokens of Ultra-FineWeb; captions are 8 DOCCI image descriptions, scored with and without their image.
|
| 79 |
|
| 80 |
| loops | text | caption | caption, no image |
|
| 81 |
|---|---|---|---|
|
| 82 |
+
| 1 | 3.440 | 2.700 | 2.940 |
|
| 83 |
+
| 2 | 3.171 | 2.467 | 2.750 |
|
| 84 |
+
| 3 | 2.859 | 2.267 | 2.568 |
|
| 85 |
+
| 4 | 2.932 | 2.305 | 2.602 |
|
| 86 |
+
| 5 | 2.937 | 2.333 | 2.625 |
|
| 87 |
+
| 6 | 2.984 | 2.348 | 2.635 |
|
| 88 |
|
| 89 |
+
One pass costs 0.580 in text loss compared with 3. More passes than 3 make it worse (2.932 at 4 loops, 2.984 at 6). In the playground and the Mac app, the Loops slider sets this number.
|
| 90 |
|
| 91 |

|
| 92 |
|
|
|
|
| 131 |
|
| 132 |
`model(input_ids)` returns logits for every position. Generation goes through `complete()` and `generate_from()`, which keep a cache, so each new token costs one step. `transformers`' own `generate()` is not supported. Put token id 1 (`<|startoftext|>`) before your text; `complete()` does this for you.
|
| 133 |
|
| 134 |
+
The release code gives the same logits as the training code (largest difference 1e-04 in fp32, at 1, 2, 3, 4 and 6 loops).
|
| 135 |
|
| 136 |
### ONNX
|
| 137 |
|
|
|
|
| 142 |
- `core.onnx`: layers 6 to 17. Run it once per loop, and keep a separate cache for each loop.
|
| 143 |
- `coda.onnx`: layers 18 to 23 and the output head
|
| 144 |
|
| 145 |
+
`onnx/meta.json` lists the inputs of each graph. The `engine.js` file of the Space shows how to call them. The weights are stored in fp16 and computed in fp32, so the ONNX graphs give the same results as PyTorch: on validation text the loss is 3.7255 with ONNX and 3.7255 with PyTorch. The four files take 467 MB. Dynamic int8 quantization was tried first; on some checkpoints it raised the loss by up to 0.17, so it is not used.
|
| 146 |
|
| 147 |
## Limitations
|
| 148 |
|
| 149 |
+
- It is a small model, and it was trained on only 8.74B tokens. Its output often contains false facts and repeats itself.
|
| 150 |
- It is a base model with no instruction tuning and no safety tuning.
|
| 151 |
- Most of the training data is in English.
|
| 152 |
- Its image skills are basic. Its captions name the main content of a photo, but they often get details, counts and text in the image wrong.
|
| 153 |
+
- It was trained only on sequences of up to 4,096 tokens. Longer inputs are not tested.
|
| 154 |
|
| 155 |
## Licenses
|
| 156 |
|
assets/loops.png
CHANGED
|
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 754789964
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:944a76d9aad2f8964a10c40b7508792c60091559dc7c158dcad061f3ff4cbf2b
|
| 3 |
size 754789964
|
onnx/coda.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 156196840
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6322c7dc586f2f80b7be59623bfec63e6595826d428267049354126a8a383118
|
| 3 |
size 156196840
|
onnx/core.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 144792550
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:39a3435e19df286ba3bea49ddc0bf389399096348c30081cd998a6c4da9d2cd7
|
| 3 |
size 144792550
|
onnx/prelude.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 157345160
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b7e268514d398bbe88fd5ab3d3a85da43e88af37710b0b6881771ccf379646da
|
| 3 |
size 157345160
|
onnx/stem.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 8865118
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:237404eebd7882f29162af941272b465e55a58ef702492d78ffef218de3fc754
|
| 3 |
size 8865118
|