Safetensors
llama
intervitens commited on
Commit
49f37c0
1 Parent(s): 9575778

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +147 -145
README.md CHANGED
@@ -1,146 +1,148 @@
1
- ---
2
- license: other
3
- license_name: nvidia-open-model-license
4
- license_link: >-
5
- https://developer.download.nvidia.com/licenses/nvidia-open-model-license-agreement-june-2024.pdf
6
- ---
7
- # Llama-3.1-Minitron-4B-Width-Base
8
-
9
- ## Model Overview
10
-
11
- Llama-3.1-Minitron-4B-Width-Base is a base text-to-text model that can be adopted for a variety of natural language generation tasks.
12
- It is obtained by pruning Llama-3.1-8B; specifically, we prune model embedding size and MLP intermediate dimension.
13
- Following pruning, we perform continued training with distillation using 94 billion tokens to arrive at the final model; we use the continuous pre-training data corpus used in Nemotron-4 15B for this purpose.
14
-
15
- This model is ready for commercial use.
16
-
17
- **Model Developer:** NVIDIA
18
-
19
- **Model Dates:** Llama-3.1-Minitron-4B-Width-Base was trained between July 29, 2024 and Aug 3, 2024.
20
-
21
- ## License
22
-
23
- This model is released under the [NVIDIA Open Model License Agreement](https://developer.download.nvidia.com/licenses/nvidia-open-model-license-agreement-june-2024.pdf).
24
-
25
- ## Model Architecture
26
-
27
- Llama-3.1-Minitron-4B-Width-Base uses a model embedding size of 3072, 32 attention heads, MLP intermediate dimension of 9216, with 32 layers in total. Additionally, it uses Grouped-Query Attention (GQA) and Rotary Position Embeddings (RoPE).
28
-
29
- **Architecture Type:** Transformer Decoder (Auto-Regressive Language Model)
30
-
31
- **Network Architecture:** Llama-3.1
32
-
33
- **Input Type(s):** Text
34
-
35
- **Input Format(s):** String
36
-
37
- **Input Parameters:** None
38
-
39
- **Other Properties Related to Input:** Works well within 8k characters or less.
40
-
41
- **Output Type(s):** Text
42
-
43
- **Output Format:** String
44
-
45
- **Output Parameters:** 1D
46
-
47
- **Other Properties Related to Output:** None
48
-
49
-
50
- ## Usage
51
- Support for this model will be added in the upcoming `transformers` release. In the meantime, please install the library from source:
52
- ```
53
- pip install git+https://github.com/huggingface/transformers
54
- ```
55
- We can now run inference on this model:
56
-
57
- ```python
58
- import torch
59
- from transformers import AutoTokenizer, LlamaForCausalLM
60
-
61
- # Load the tokenizer and model
62
- model_path = "nvidia/Llama3.1-Minitron-4B-Width-Base"
63
- tokenizer = AutoTokenizer.from_pretrained(model_path)
64
-
65
- device = 'cuda'
66
- dtype = torch.bfloat16
67
- model = LlamaForCausalLM.from_pretrained(model_path, torch_dtype=dtype, device_map=device)
68
-
69
- # Prepare the input text
70
- prompt = 'Complete the paragraph: our solar system is'
71
- inputs = tokenizer.encode(prompt, return_tensors='pt').to(model.device)
72
-
73
- # Generate the output
74
- outputs = model.generate(inputs, max_length=20)
75
-
76
- # Decode and print the output
77
- output_text = tokenizer.decode(outputs[0])
78
- print(output_text)
79
- ```
80
-
81
- ## Software Integration
82
- **Runtime Engine(s):**
83
- * NeMo 24.05
84
-
85
- **Supported Hardware Microarchitecture Compatibility:** <br>
86
- * NVIDIA Ampere
87
- * NVIDIA Blackwell
88
- * NVIDIA Hopper
89
- * NVIDIA Lovelace
90
-
91
-
92
- **[Preferred/Supported] Operating System(s):** <br>
93
- * Linux
94
-
95
- ## Dataset & Training
96
-
97
- **Data Collection Method by Dataset:** Automated
98
-
99
- **Labeling Method by Dataset:** Not Applicable
100
-
101
- **Properties:**
102
- The training corpus for Llama-3.1-Minitron-4B-Width-Base consists of English and multilingual text, as well as code. Our sources cover a variety of document types such as: webpages, dialogue, articles, and other written materials. The corpus spans domains including legal, math, science, finance, and more. In our continued training set, we introduce a small portion of question-answering, and alignment style data to improve model performance.
103
-
104
- **Data Freshness:** The pretraining data has a cutoff of June 2023.
105
-
106
- ## Evaluation Results
107
-
108
- ### Overview
109
- _5-shot performance._ Language Understanding evaluated using [Massive Multitask Language Understanding](https://arxiv.org/abs/2009.03300):
110
-
111
- | Average |
112
- | :---- |
113
- | 60.5 |
114
-
115
- _Zero-shot performance._ Evaluated using select datasets from the [LM Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) with additions:
116
-
117
- | HellaSwag | Winogrande | GSM8K| ARC-Challenge | XLSum |
118
- | :---- | :---- | :---- | :---- | :---- |
119
- | 76.1 | 73.5 | 41.2 | 55.6 | 28.7
120
-
121
- _Code generation performance._ Evaluated using [MBPP](https://github.com/google-research/google-research/tree/master/mbpp):
122
- | Score |
123
- | :---- |
124
- | 32.0 |
125
-
126
- ## Inference
127
-
128
- **Engine:** TensorRT-LLM
129
-
130
- **Test Hardware:** NVIDIA A100
131
-
132
- **DType:** BFloat16
133
-
134
-
135
- ## Limitations
136
-
137
- The model was trained on data that contains toxic language, unsafe content, and societal biases originally crawled from the internet. Therefore, the model may amplify those biases and return toxic responses especially when prompted with toxic prompts. The model may generate answers that may be inaccurate, omit key information, or include irrelevant or redundant text producing socially unacceptable or undesirable text, even if the prompt itself does not include anything explicitly offensive.
138
-
139
- ## Ethical Considerations
140
-
141
- NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
142
-
143
- Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
144
-
145
- ## References
 
 
146
  * [Compact Language Models via Pruning and Knowledge Distillation](https://arxiv.org/abs/2407.14679)
 
1
+ ---
2
+ license: other
3
+ license_name: nvidia-open-model-license
4
+ license_link: >-
5
+ https://developer.download.nvidia.com/licenses/nvidia-open-model-license-agreement-june-2024.pdf
6
+ ---
7
+ Version with added chatml tokens for finetuning.
8
+
9
+ # Llama-3.1-Minitron-4B-Width-Base
10
+
11
+ ## Model Overview
12
+
13
+ Llama-3.1-Minitron-4B-Width-Base is a base text-to-text model that can be adopted for a variety of natural language generation tasks.
14
+ It is obtained by pruning Llama-3.1-8B; specifically, we prune model embedding size and MLP intermediate dimension.
15
+ Following pruning, we perform continued training with distillation using 94 billion tokens to arrive at the final model; we use the continuous pre-training data corpus used in Nemotron-4 15B for this purpose.
16
+
17
+ This model is ready for commercial use.
18
+
19
+ **Model Developer:** NVIDIA
20
+
21
+ **Model Dates:** Llama-3.1-Minitron-4B-Width-Base was trained between July 29, 2024 and Aug 3, 2024.
22
+
23
+ ## License
24
+
25
+ This model is released under the [NVIDIA Open Model License Agreement](https://developer.download.nvidia.com/licenses/nvidia-open-model-license-agreement-june-2024.pdf).
26
+
27
+ ## Model Architecture
28
+
29
+ Llama-3.1-Minitron-4B-Width-Base uses a model embedding size of 3072, 32 attention heads, MLP intermediate dimension of 9216, with 32 layers in total. Additionally, it uses Grouped-Query Attention (GQA) and Rotary Position Embeddings (RoPE).
30
+
31
+ **Architecture Type:** Transformer Decoder (Auto-Regressive Language Model)
32
+
33
+ **Network Architecture:** Llama-3.1
34
+
35
+ **Input Type(s):** Text
36
+
37
+ **Input Format(s):** String
38
+
39
+ **Input Parameters:** None
40
+
41
+ **Other Properties Related to Input:** Works well within 8k characters or less.
42
+
43
+ **Output Type(s):** Text
44
+
45
+ **Output Format:** String
46
+
47
+ **Output Parameters:** 1D
48
+
49
+ **Other Properties Related to Output:** None
50
+
51
+
52
+ ## Usage
53
+ Support for this model will be added in the upcoming `transformers` release. In the meantime, please install the library from source:
54
+ ```
55
+ pip install git+https://github.com/huggingface/transformers
56
+ ```
57
+ We can now run inference on this model:
58
+
59
+ ```python
60
+ import torch
61
+ from transformers import AutoTokenizer, LlamaForCausalLM
62
+
63
+ # Load the tokenizer and model
64
+ model_path = "nvidia/Llama3.1-Minitron-4B-Width-Base"
65
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
66
+
67
+ device = 'cuda'
68
+ dtype = torch.bfloat16
69
+ model = LlamaForCausalLM.from_pretrained(model_path, torch_dtype=dtype, device_map=device)
70
+
71
+ # Prepare the input text
72
+ prompt = 'Complete the paragraph: our solar system is'
73
+ inputs = tokenizer.encode(prompt, return_tensors='pt').to(model.device)
74
+
75
+ # Generate the output
76
+ outputs = model.generate(inputs, max_length=20)
77
+
78
+ # Decode and print the output
79
+ output_text = tokenizer.decode(outputs[0])
80
+ print(output_text)
81
+ ```
82
+
83
+ ## Software Integration
84
+ **Runtime Engine(s):**
85
+ * NeMo 24.05
86
+
87
+ **Supported Hardware Microarchitecture Compatibility:** <br>
88
+ * NVIDIA Ampere
89
+ * NVIDIA Blackwell
90
+ * NVIDIA Hopper
91
+ * NVIDIA Lovelace
92
+
93
+
94
+ **[Preferred/Supported] Operating System(s):** <br>
95
+ * Linux
96
+
97
+ ## Dataset & Training
98
+
99
+ **Data Collection Method by Dataset:** Automated
100
+
101
+ **Labeling Method by Dataset:** Not Applicable
102
+
103
+ **Properties:**
104
+ The training corpus for Llama-3.1-Minitron-4B-Width-Base consists of English and multilingual text, as well as code. Our sources cover a variety of document types such as: webpages, dialogue, articles, and other written materials. The corpus spans domains including legal, math, science, finance, and more. In our continued training set, we introduce a small portion of question-answering, and alignment style data to improve model performance.
105
+
106
+ **Data Freshness:** The pretraining data has a cutoff of June 2023.
107
+
108
+ ## Evaluation Results
109
+
110
+ ### Overview
111
+ _5-shot performance._ Language Understanding evaluated using [Massive Multitask Language Understanding](https://arxiv.org/abs/2009.03300):
112
+
113
+ | Average |
114
+ | :---- |
115
+ | 60.5 |
116
+
117
+ _Zero-shot performance._ Evaluated using select datasets from the [LM Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) with additions:
118
+
119
+ | HellaSwag | Winogrande | GSM8K| ARC-Challenge | XLSum |
120
+ | :---- | :---- | :---- | :---- | :---- |
121
+ | 76.1 | 73.5 | 41.2 | 55.6 | 28.7
122
+
123
+ _Code generation performance._ Evaluated using [MBPP](https://github.com/google-research/google-research/tree/master/mbpp):
124
+ | Score |
125
+ | :---- |
126
+ | 32.0 |
127
+
128
+ ## Inference
129
+
130
+ **Engine:** TensorRT-LLM
131
+
132
+ **Test Hardware:** NVIDIA A100
133
+
134
+ **DType:** BFloat16
135
+
136
+
137
+ ## Limitations
138
+
139
+ The model was trained on data that contains toxic language, unsafe content, and societal biases originally crawled from the internet. Therefore, the model may amplify those biases and return toxic responses especially when prompted with toxic prompts. The model may generate answers that may be inaccurate, omit key information, or include irrelevant or redundant text producing socially unacceptable or undesirable text, even if the prompt itself does not include anything explicitly offensive.
140
+
141
+ ## Ethical Considerations
142
+
143
+ NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
144
+
145
+ Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
146
+
147
+ ## References
148
  * [Compact Language Models via Pruning and Knowledge Distillation](https://arxiv.org/abs/2407.14679)