DarkSca commited on
Commit
61d2cca
·
verified ·
1 Parent(s): e961953

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. .trillim-quantize-complete +1 -0
  2. README.md +53 -73
  3. qmodel.tensors +1 -1
  4. rope.cache +1 -1
  5. trillim_config.json +4 -3
.trillim-quantize-complete ADDED
@@ -0,0 +1 @@
 
 
1
+ ready
README.md CHANGED
@@ -1,100 +1,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
- ![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
- ```
 
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:dac515e8b10b37393cdb0d46fb714ca1669c3df425ecabf48fa9f9ca8fc2bf7d
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:2693aebd9943593bbf03659ebfcb55dfc07292e55b374d21f2aef1ca17d2b124
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.0",
3
- "format_version": 3,
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": "2a4a26b03d12d1fc60386f184537621d0d2a1fd455815999418389c66a906b91"
 
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
  }