DarkSca commited on
Commit
9330c86
·
verified ·
1 Parent(s): dc075fd

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. .trillim_cache.json +11 -0
  2. README.md +73 -53
  3. qmodel.tensors +2 -2
  4. 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
- 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
 
14
- # Llama3-TRNQ
15
 
16
- Built with Meta Llama 3.
17
 
18
- 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.
 
 
19
 
20
- This model runs entirely on CPU — no GPU required.
21
 
22
  ## Model Details
23
 
24
- | | |
25
- |---|---|
26
- | **Architecture** | Llama (LlamaForCausalLM) |
27
- | **Parameters** | ~8B |
28
- | **Hidden size** | 4096 |
29
- | **Layers** | 32 |
30
- | **Attention heads** | 32 (8 KV heads) |
31
- | **Context length** | 8192 |
32
- | **Quantization** | Ternary ({-1, 0, 1}) |
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
- ## Usage
37
 
 
38
  ```bash
39
- pip install trillim
40
- trillim pull Trillim/Llama3-TRNQ
41
- trillim serve Trillim/Llama3-TRNQ
42
  ```
 
 
43
 
44
- This starts an OpenAI-compatible API server at `http://127.0.0.1:8000`.
 
45
 
46
- For interactive CLI chat:
47
 
48
- ```bash
49
- trillim chat Trillim/Llama3-TRNQ
 
 
50
  ```
51
 
52
- ## What's in this repo
 
 
 
 
 
 
53
 
54
- | File | Description |
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
- ## License
 
 
64
 
65
- 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/).
 
66
 
67
- ### Meta Llama 3 Community License Agreement
 
 
 
68
 
69
- Meta Llama 3 is licensed under the Meta Llama 3 Community License, Copyright (c) Meta Platforms, Inc. All Rights Reserved.
 
70
 
71
- **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/).
 
 
72
 
73
- **License terms:** The full license text is available at [https://llama.meta.com/llama3/license/](https://llama.meta.com/llama3/license/). Key terms include:
 
74
 
75
- - You may use, reproduce, distribute, and create derivative works of Llama 3.
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
- For the complete license terms, please refer to the [official license](https://llama.meta.com/llama3/license/).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ![results](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/blog/1.58llm_extreme_quantization/metrics_100B_table.png)
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:d1556b45b32e5c6f336ba4e90aefbf290fc2096fdae3d0155e57574549881502
3
- size 3321887504
 
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
- "trillim_version": "0.1.0",
3
- "format_version": 1,
4
- "quantization": "ternary",
5
- "source_model": "HF1BitLLM/Llama3-8B-1.58-100B-tokens",
6
- "architecture": "llama",
7
- "platforms": ["x86_64", "aarch64"]
 
 
 
 
 
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
  }