pmolchanov commited on
Commit
47f17b2
·
verified ·
1 Parent(s): 40d82bc

Update README.md

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