Upload folder using huggingface_hub
Browse files- .trillim-quantize-complete +1 -0
- README.md +53 -73
- qmodel.tensors +1 -1
- rope.cache +1 -1
- trillim_config.json +4 -3
.trillim-quantize-complete
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
ready
|
README.md
CHANGED
|
@@ -1,100 +1,80 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
The **Llama3-8B-1.58** models are large language models fine-tuned on the **BitNet 1.58b architecture**, starting from the base model **Llama-3-8B-Instruct**.
|
| 12 |
-
|
| 13 |
-
For a deeper dive into the methods and results, check out our [blog post](https://huggingface.co/blog/1_58_llm_extreme_quantization).
|
| 14 |
|
|
|
|
| 15 |
|
| 16 |
## Model Details
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
##
|
| 27 |
|
| 28 |
-
You can easily load and test our model in Transformers. Just follow the code below:
|
| 29 |
-
|
| 30 |
-
Start by installing the transformers version with the correct configuration to load bitnet models
|
| 31 |
```bash
|
| 32 |
-
pip install
|
|
|
|
|
|
|
| 33 |
```
|
| 34 |
-
And then load the model :
|
| 35 |
-
```python
|
| 36 |
|
| 37 |
-
|
| 38 |
-
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 45 |
-
print(generated_text)
|
| 46 |
```
|
| 47 |
|
| 48 |
-
##
|
| 49 |
-
|
| 50 |
-
### Training Data
|
| 51 |
-
|
| 52 |
-
The model was trained on a subset of [FineWeb-edu](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu)
|
| 53 |
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
-
|
| 57 |
-
- Best-performing checkpoint from the 10 billion token runs with a linear lambda scheduler
|
| 58 |
|
| 59 |
-
|
| 60 |
-
- Fine-tuned for an additional 45,000 steps
|
| 61 |
-
- Reached a total of 100 billion tokens
|
| 62 |
|
| 63 |
-
3
|
| 64 |
-
- FineWeb-edu dataset
|
| 65 |
|
| 66 |
-
|
| 67 |
-
- 2 million tokens per step
|
| 68 |
-
- Total per run: 45,000 steps * 2 million tokens = 90 billion tokens
|
| 69 |
-
- Combined with initial 10 billion tokens to reach 100 billion
|
| 70 |
|
| 71 |
-
|
| 72 |
-
- Tested various learning rates to find optimal setting, according the to experiments, the best performing peak lr is 1e-5
|
| 73 |
|
| 74 |
-
|
| 75 |
-
- Close to Llama3 8B on some metrics
|
| 76 |
-
- Behind Llama3 8B in overall average performance
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
|
|
|
|
|
|
| 80 |
|
| 81 |
-
|
| 82 |
|
| 83 |
-
|
| 84 |
-
## Evaluation
|
| 85 |
-
|
| 86 |
-
The evaluation of the models is done on the nanotron checkpoints using LightEval :
|
| 87 |
-
|
| 88 |
-

|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
## Citation
|
| 93 |
-
|
| 94 |
-
```bash
|
| 95 |
-
@misc{,
|
| 96 |
-
title={1.58-Bit LLM: A New Era of Extreme Quantization},
|
| 97 |
-
author={Mohamed Mekkouri and Marc Sun and Leandro von Werra and Thomas Wolf},
|
| 98 |
-
year={2024},
|
| 99 |
-
}
|
| 100 |
-
```
|
|
|
|
| 1 |
---
|
| 2 |
+
license: llama3
|
| 3 |
+
tags:
|
| 4 |
+
- llama3
|
| 5 |
+
- ternary
|
| 6 |
+
- trillim
|
| 7 |
+
- cpu-inference
|
| 8 |
+
base_model: HF1BitLLM/Llama3-8B-1.58-100B-tokens
|
| 9 |
+
extra_gated_prompt: >-
|
| 10 |
+
This model is derived from Meta Llama 3. By accessing this model you agree to
|
| 11 |
+
the Meta Llama 3 Community License Agreement.
|
| 12 |
---
|
| 13 |
+
# Llama3-TRNQ
|
| 14 |
|
| 15 |
+
Built with Meta Llama 3.
|
| 16 |
|
| 17 |
+
Ternary-quantized version of [HF1BitLLM/Llama3-8B-1.58-100B-tokens](https://huggingface.co/HF1BitLLM/Llama3-8B-1.58-100B-tokens), packaged for the [Trillim DarkNet](https://huggingface.co/Trillim) inference engine. The source model is a BitNet 1.58b quantization of [Meta-Llama-3-8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B), trained on the FineWeb-edu dataset.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
This model runs entirely on CPU — no GPU required.
|
| 20 |
|
| 21 |
## Model Details
|
| 22 |
|
| 23 |
+
| | |
|
| 24 |
+
|---|---|
|
| 25 |
+
| **Architecture** | Llama (LlamaForCausalLM) |
|
| 26 |
+
| **Parameters** | ~8B |
|
| 27 |
+
| **Hidden size** | 4096 |
|
| 28 |
+
| **Layers** | 32 |
|
| 29 |
+
| **Attention heads** | 32 (8 KV heads) |
|
| 30 |
+
| **Context length** | 8192 |
|
| 31 |
+
| **Quantization** | Ternary ({-1, 0, 1}) |
|
| 32 |
+
| **Source model** | [HF1BitLLM/Llama3-8B-1.58-100B-tokens](https://huggingface.co/HF1BitLLM/Llama3-8B-1.58-100B-tokens) |
|
| 33 |
+
| **License** | [Meta Llama 3 Community License](https://llama.meta.com/llama3/license/) |
|
| 34 |
|
| 35 |
+
## Usage
|
| 36 |
|
|
|
|
|
|
|
|
|
|
| 37 |
```bash
|
| 38 |
+
pip install trillim
|
| 39 |
+
trillim pull Trillim/Llama3-TRNQ
|
| 40 |
+
trillim serve Trillim/Llama3-TRNQ
|
| 41 |
```
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
This starts an OpenAI-compatible API server at `http://127.0.0.1:8000`.
|
|
|
|
| 44 |
|
| 45 |
+
For interactive CLI chat:
|
| 46 |
|
| 47 |
+
```bash
|
| 48 |
+
trillim chat Trillim/Llama3-TRNQ
|
|
|
|
|
|
|
| 49 |
```
|
| 50 |
|
| 51 |
+
## What's in this repo
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
| File | Description |
|
| 54 |
+
|---|---|
|
| 55 |
+
| `qmodel.tensors` | Ternary-quantized weights in Trillim format |
|
| 56 |
+
| `rope.cache` | Precomputed RoPE embeddings |
|
| 57 |
+
| `config.json` | Model configuration |
|
| 58 |
+
| `tokenizer.json` | Tokenizer |
|
| 59 |
+
| `tokenizer_config.json` | Tokenizer configuration |
|
| 60 |
+
| `trillim_config.json` | Trillim metadata |
|
| 61 |
|
| 62 |
+
## License
|
|
|
|
| 63 |
|
| 64 |
+
This model is derived from Meta Llama 3 and is subject to the [Meta Llama 3 Community License Agreement](https://llama.meta.com/llama3/license/).
|
|
|
|
|
|
|
| 65 |
|
| 66 |
+
### Meta Llama 3 Community License Agreement
|
|
|
|
| 67 |
|
| 68 |
+
Meta Llama 3 is licensed under the Meta Llama 3 Community License, Copyright (c) Meta Platforms, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
+
**Acceptable Use Policy:** Your use of Llama 3 must comply with applicable laws and regulations and you must comply with Meta's [Acceptable Use Policy](https://llama.meta.com/llama3/use-policy/).
|
|
|
|
| 71 |
|
| 72 |
+
**License terms:** The full license text is available at [https://llama.meta.com/llama3/license/](https://llama.meta.com/llama3/license/). Key terms include:
|
|
|
|
|
|
|
| 73 |
|
| 74 |
+
- You may use, reproduce, distribute, and create derivative works of Llama 3.
|
| 75 |
+
- If you distribute or make Llama 3 available to a third party, you must provide a copy of this Agreement and include "Built with Meta Llama 3" in related materials.
|
| 76 |
+
- You must not use Llama 3 to improve any other large language model (excluding Llama 3 derivatives).
|
| 77 |
+
- If the monthly active users of your products or services exceed 700 million, you must request a license from Meta.
|
| 78 |
|
| 79 |
+
For the complete license terms, please refer to the [official license](https://llama.meta.com/llama3/license/).
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qmodel.tensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 3846711056
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:80b146ed4e23ed6424ee411d807f27747044a28e1a1ce176a0b010f9f6f25354
|
| 3 |
size 3846711056
|
rope.cache
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 8388620
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e4b666424eafa16c6cd913ecca1b1c35f7b67b45219f3c33a84ccc931e43703c
|
| 3 |
size 8388620
|
trillim_config.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
-
"trillim_version": "0.
|
| 3 |
-
"format_version":
|
| 4 |
"type": "model",
|
| 5 |
"quantization": "ternary",
|
| 6 |
"source_model": "/fsx/mohamed/scripts_training/quantized_model_llama_8B_10",
|
|
@@ -9,5 +9,6 @@
|
|
| 9 |
"x86_64",
|
| 10 |
"aarch64"
|
| 11 |
],
|
| 12 |
-
"base_model_config_hash": "
|
|
|
|
| 13 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"trillim_version": "0.6.0",
|
| 3 |
+
"format_version": 4,
|
| 4 |
"type": "model",
|
| 5 |
"quantization": "ternary",
|
| 6 |
"source_model": "/fsx/mohamed/scripts_training/quantized_model_llama_8B_10",
|
|
|
|
| 9 |
"x86_64",
|
| 10 |
"aarch64"
|
| 11 |
],
|
| 12 |
+
"base_model_config_hash": "233d1e1302674be61b0a44dbb3a2319d6bf30ebd81307c029a3d8683f1d389a6",
|
| 13 |
+
"remote_code": false
|
| 14 |
}
|