NeMo
Safetensors
llama

Update metadata

#14
by pcuenq HF staff - opened
Files changed (1) hide show
  1. README.md +151 -147
README.md CHANGED
@@ -1,148 +1,152 @@
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. Please refer to our [technical report](https://arxiv.org/abs/2408.11796) for more details.
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/Llama-3.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
-
147
- * [Compact Language Models via Pruning and Knowledge Distillation](https://arxiv.org/abs/2407.14679)
 
 
 
 
148
  * [LLM Pruning and Distillation in Practice: The Minitron Approach](https://arxiv.org/abs/2408.11796)
 
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
+ pipeline_tag: text-generation
7
+ library_name: transformers
8
+ tags:
9
+ - nemo
10
+ ---
11
+ # Llama-3.1-Minitron-4B-Width-Base
12
+
13
+ ## Model Overview
14
+
15
+ 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.
16
+ It is obtained by pruning Llama-3.1-8B; specifically, we prune model embedding size and MLP intermediate dimension.
17
+ 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. Please refer to our [technical report](https://arxiv.org/abs/2408.11796) for more details.
18
+
19
+ This model is ready for commercial use.
20
+
21
+ **Model Developer:** NVIDIA
22
+
23
+ **Model Dates:** Llama-3.1-Minitron-4B-Width-Base was trained between July 29, 2024 and Aug 3, 2024.
24
+
25
+ ## License
26
+
27
+ 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).
28
+
29
+ ## Model Architecture
30
+
31
+ 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).
32
+
33
+ **Architecture Type:** Transformer Decoder (Auto-Regressive Language Model)
34
+
35
+ **Network Architecture:** Llama-3.1
36
+
37
+ **Input Type(s):** Text
38
+
39
+ **Input Format(s):** String
40
+
41
+ **Input Parameters:** None
42
+
43
+ **Other Properties Related to Input:** Works well within 8k characters or less.
44
+
45
+ **Output Type(s):** Text
46
+
47
+ **Output Format:** String
48
+
49
+ **Output Parameters:** 1D
50
+
51
+ **Other Properties Related to Output:** None
52
+
53
+
54
+ ## Usage
55
+ Support for this model will be added in the upcoming `transformers` release. In the meantime, please install the library from source:
56
+ ```
57
+ pip install git+https://github.com/huggingface/transformers
58
+ ```
59
+ We can now run inference on this model:
60
+
61
+ ```python
62
+ import torch
63
+ from transformers import AutoTokenizer, LlamaForCausalLM
64
+
65
+ # Load the tokenizer and model
66
+ model_path = "nvidia/Llama-3.1-Minitron-4B-Width-Base"
67
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
68
+
69
+ device = 'cuda'
70
+ dtype = torch.bfloat16
71
+ model = LlamaForCausalLM.from_pretrained(model_path, torch_dtype=dtype, device_map=device)
72
+
73
+ # Prepare the input text
74
+ prompt = 'Complete the paragraph: our solar system is'
75
+ inputs = tokenizer.encode(prompt, return_tensors='pt').to(model.device)
76
+
77
+ # Generate the output
78
+ outputs = model.generate(inputs, max_length=20)
79
+
80
+ # Decode and print the output
81
+ output_text = tokenizer.decode(outputs[0])
82
+ print(output_text)
83
+ ```
84
+
85
+ ## Software Integration
86
+ **Runtime Engine(s):**
87
+ * NeMo 24.05
88
+
89
+ **Supported Hardware Microarchitecture Compatibility:** <br>
90
+ * NVIDIA Ampere
91
+ * NVIDIA Blackwell
92
+ * NVIDIA Hopper
93
+ * NVIDIA Lovelace
94
+
95
+
96
+ **[Preferred/Supported] Operating System(s):** <br>
97
+ * Linux
98
+
99
+ ## Dataset & Training
100
+
101
+ **Data Collection Method by Dataset:** Automated
102
+
103
+ **Labeling Method by Dataset:** Not Applicable
104
+
105
+ **Properties:**
106
+ 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.
107
+
108
+ **Data Freshness:** The pretraining data has a cutoff of June 2023.
109
+
110
+ ## Evaluation Results
111
+
112
+ ### Overview
113
+ _5-shot performance._ Language Understanding evaluated using [Massive Multitask Language Understanding](https://arxiv.org/abs/2009.03300):
114
+
115
+ | Average |
116
+ | :---- |
117
+ | 60.5 |
118
+
119
+ _Zero-shot performance._ Evaluated using select datasets from the [LM Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) with additions:
120
+
121
+ | HellaSwag | Winogrande | GSM8K| ARC-Challenge | XLSum |
122
+ | :---- | :---- | :---- | :---- | :---- |
123
+ | 76.1 | 73.5 | 41.2 | 55.6 | 28.7
124
+
125
+ _Code generation performance._ Evaluated using [MBPP](https://github.com/google-research/google-research/tree/master/mbpp):
126
+ | Score |
127
+ | :---- |
128
+ | 32.0 |
129
+
130
+ ## Inference
131
+
132
+ **Engine:** TensorRT-LLM
133
+
134
+ **Test Hardware:** NVIDIA A100
135
+
136
+ **DType:** BFloat16
137
+
138
+
139
+ ## Limitations
140
+
141
+ 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.
142
+
143
+ ## Ethical Considerations
144
+
145
+ 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.
146
+
147
+ Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
148
+
149
+ ## References
150
+
151
+ * [Compact Language Models via Pruning and Knowledge Distillation](https://arxiv.org/abs/2407.14679)
152
  * [LLM Pruning and Distillation in Practice: The Minitron Approach](https://arxiv.org/abs/2408.11796)