Upload folder using huggingface_hub
Browse files- .trillim_cache.json +11 -0
- README.md +73 -53
- qmodel.tensors +2 -2
- trillim_config.json +11 -6
.trillim_cache.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"config_hash": "1eff32ddbdc3af6fa70f226808356ac33682ea50fc6d61411e9634ec11895676",
|
| 3 |
+
"config_h_hash": "1b3947afb731149bdf242207ff1a9abaf719bbeb3fdd787ecb1f81cc23493c7c",
|
| 4 |
+
"generate_h_hash": "82c7216b1f207e7e384eec66eb1b6406e7dcd42121cbb87534a611e5cdcc90dc",
|
| 5 |
+
"safetensor_mtimes": {
|
| 6 |
+
"model.safetensors": 1768459059.0255861
|
| 7 |
+
},
|
| 8 |
+
"output_dir": "/home/darksca/Vineet/Code/Startups/1bitLLM/DarkNet/include/model",
|
| 9 |
+
"adapter_state": null,
|
| 10 |
+
"version": 1
|
| 11 |
+
}
|
README.md
CHANGED
|
@@ -1,80 +1,100 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 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 |
|
| 14 |
-
#
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
This model runs entirely on CPU — no GPU required.
|
| 21 |
|
| 22 |
## Model Details
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
| **Source model** | [HF1BitLLM/Llama3-8B-1.58-100B-tokens](https://huggingface.co/HF1BitLLM/Llama3-8B-1.58-100B-tokens) |
|
| 34 |
-
| **License** | [Meta Llama 3 Community License](https://llama.meta.com/llama3/license/) |
|
| 35 |
|
| 36 |
-
|
| 37 |
|
|
|
|
| 38 |
```bash
|
| 39 |
-
pip install
|
| 40 |
-
trillim pull Trillim/Llama3-TRNQ
|
| 41 |
-
trillim serve Trillim/Llama3-TRNQ
|
| 42 |
```
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
|
|
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
```
|
| 51 |
|
| 52 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
| `qmodel.tensors` | Ternary-quantized weights in Trillim format |
|
| 57 |
-
| `rope.cache` | Precomputed RoPE embeddings |
|
| 58 |
-
| `config.json` | Model configuration |
|
| 59 |
-
| `tokenizer.json` | Tokenizer |
|
| 60 |
-
| `tokenizer_config.json` | Tokenizer configuration |
|
| 61 |
-
| `trillim_config.json` | Trillim metadata |
|
| 62 |
|
| 63 |
-
|
|
|
|
|
|
|
| 64 |
|
| 65 |
-
|
|
|
|
| 66 |
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
|
|
|
|
| 70 |
|
| 71 |
-
**
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
**
|
|
|
|
| 74 |
|
| 75 |
-
|
| 76 |
-
- 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.
|
| 77 |
-
- You must not use Llama 3 to improve any other large language model (excluding Llama 3 derivatives).
|
| 78 |
-
- If the monthly active users of your products or services exceed 700 million, you must request a license from Meta.
|
| 79 |
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
base_model:
|
| 4 |
+
- meta-llama/Meta-Llama-3-8B-Instruct
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
|
| 7 |
+
# Model Card for Model ID
|
| 8 |
|
| 9 |
+
### Llama3-8B-1.58 Models
|
| 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 |
+
### Model Sources
|
| 19 |
+
|
| 20 |
+
<!-- Provide the basic links for the model. -->
|
| 21 |
+
|
| 22 |
+
- **Repository:** [Model](https://huggingface.co/HF1BitLLM/Llama3-8B-1.58-100B-tokens)
|
| 23 |
+
- **Paper:** [The Era of 1-bit LLMs: All Large Language Models are in 1.58 Bits](https://arxiv.org/abs/2402.17764)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
## How to Get Started with the Model
|
|
|
|
|
|
|
| 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 git+https://github.com/huggingface/transformers.git@refs/pull/33410/head
|
|
|
|
|
|
|
| 33 |
```
|
| 34 |
+
And then load the model :
|
| 35 |
+
```python
|
| 36 |
|
| 37 |
+
model = AutoModelForCausalLM.from_pretrained("HF1BitLLM/Llama3-8B-1.58-100B-tokens", device_map="cuda", torch_dtype=torch.bfloat16)
|
| 38 |
+
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
|
| 39 |
|
| 40 |
+
input_text = "Daniel went back to the the the garden. Mary travelled to the kitchen. Sandra journeyed to the kitchen. Sandra went to the hallway. John went to the bedroom. Mary went back to the garden. Where is Mary?\nAnswer:"
|
| 41 |
|
| 42 |
+
input_ids = tokenizer.encode(input_text, return_tensors="pt").cuda()
|
| 43 |
+
output = model.generate(input_ids, max_length=10, do_sample=False)
|
| 44 |
+
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 45 |
+
print(generated_text)
|
| 46 |
```
|
| 47 |
|
| 48 |
+
## Training Details
|
| 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 |
+
### Training Process
|
| 55 |
|
| 56 |
+
1. **Starting Point**
|
| 57 |
+
- Best-performing checkpoint from the 10 billion token runs with a linear lambda scheduler
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
2. **Training Duration**
|
| 60 |
+
- Fine-tuned for an additional 45,000 steps
|
| 61 |
+
- Reached a total of 100 billion tokens
|
| 62 |
|
| 63 |
+
3. **Dataset**
|
| 64 |
+
- FineWeb-edu dataset
|
| 65 |
|
| 66 |
+
4. **Batch Size**
|
| 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 |
+
5. **Learning Rate Experiments**
|
| 72 |
+
- Tested various learning rates to find optimal setting, according the to experiments, the best performing peak lr is 1e-5
|
| 73 |
|
| 74 |
+
6. **Performance**
|
| 75 |
+
- Close to Llama3 8B on some metrics
|
| 76 |
+
- Behind Llama3 8B in overall average performance
|
| 77 |
|
| 78 |
+
7. **Evaluation**
|
| 79 |
+
- Metrics included perplexity, MMLU scores, and other standard benchmarks
|
| 80 |
|
| 81 |
+
These extended training runs on 100 billion tokens pushed the boundaries of highly quantized models, bringing performance closer to half-precision models like Llama3.
|
|
|
|
|
|
|
|
|
|
| 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 |
+
```
|
qmodel.tensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ace580c8ded34d25fc8ed35ea8fe38be66dd17eabc130a18373d085fbacfc3a2
|
| 3 |
+
size 3846711056
|
trillim_config.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
| 1 |
{
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"trillim_version": "0.2.0",
|
| 3 |
+
"format_version": 2,
|
| 4 |
+
"type": "model",
|
| 5 |
+
"quantization": "ternary",
|
| 6 |
+
"source_model": "/fsx/mohamed/scripts_training/quantized_model_llama_8B_10",
|
| 7 |
+
"architecture": "llama",
|
| 8 |
+
"platforms": [
|
| 9 |
+
"x86_64",
|
| 10 |
+
"aarch64"
|
| 11 |
+
],
|
| 12 |
+
"base_model_config_hash": "2a4a26b03d12d1fc60386f184537621d0d2a1fd455815999418389c66a906b91"
|
| 13 |
}
|