NeMo
Safetensors
llama
Dimitre commited on
Commit
46f3e70
1 Parent(s): e28186c

Fixing type at model_path param

Browse files
Files changed (1) hide show
  1. README.md +157 -157
README.md CHANGED
@@ -1,158 +1,158 @@
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, number of attention heads, 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
- Pull requests
52
- to support this model in Hugging Face Transformers are currently under review
53
- ([#32495](https://github.com/huggingface/transformers/pull/32495) and [#32502](https://github.com/huggingface/transformers/pull/32502))
54
- and are expected to be merged soon. In the meantime,
55
- please follow the installation instructions below:
56
-
57
- ```
58
- # Fetch PR 32502
59
- $ git clone -b suhara/llama-kv-channels --single-branch https://github.com/suhara/transformers.git && cd transformers
60
-
61
- # Fetch changes from PR 32495
62
- $ git fetch https://github.com/suiyoubi/transformers.git aot/head_dim_rope && git cherry-pick FETCH_HEAD --strategy-option theirs
63
-
64
- # Install transformers
65
- $ pip install -e .
66
- ```
67
- We can now run inference on this model:
68
-
69
- ```python
70
- import torch
71
- from transformers import AutoTokenizer, LlamaForCausalLM
72
-
73
- # Load the tokenizer and model
74
- model_path = "nvidia/Llama3.1-Minitron-4B-Width-Base"
75
- tokenizer = AutoTokenizer.from_pretrained(model_path)
76
-
77
- device = 'cuda'
78
- dtype = torch.bfloat16
79
- model = LlamaForCausalLM.from_pretrained(model_path, torch_dtype=dtype, device_map=device)
80
-
81
- # Prepare the input text
82
- prompt = 'Complete the paragraph: our solar system is'
83
- inputs = tokenizer.encode(prompt, return_tensors='pt').to(model.device)
84
-
85
- # Generate the output
86
- outputs = model.generate(inputs, max_length=20)
87
-
88
- # Decode and print the output
89
- output_text = tokenizer.decode(outputs[0])
90
- print(output_text)
91
- ```
92
-
93
- ## Software Integration
94
- **Runtime Engine(s):**
95
- * NeMo 24.05
96
-
97
- **Supported Hardware Microarchitecture Compatibility:** <br>
98
- * NVIDIA Ampere
99
- * NVIDIA Blackwell
100
- * NVIDIA Hopper
101
- * NVIDIA Lovelace
102
-
103
-
104
- **[Preferred/Supported] Operating System(s):** <br>
105
- * Linux
106
-
107
- ## Dataset & Training
108
-
109
- **Data Collection Method by Dataset:** Automated
110
-
111
- **Labeling Method by Dataset:** Not Applicable
112
-
113
- **Properties:**
114
- 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.
115
-
116
- **Data Freshness:** The pretraining data has a cutoff of June 2023.
117
-
118
- ## Evaluation Results
119
-
120
- ### Overview
121
- _5-shot performance._ Language Understanding evaluated using [Massive Multitask Language Understanding](https://arxiv.org/abs/2009.03300):
122
-
123
- | Average |
124
- | :---- |
125
- | 60.5 |
126
-
127
- _Zero-shot performance._ Evaluated using select datasets from the [LM Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) with additions:
128
-
129
- | HellaSwag | Winogrande | GSM8K| ARC-Challenge | XLSum |
130
- | :---- | :---- | :---- | :---- | :---- |
131
- | 76.1 | 73.5 | 41.2 | 55.6 | 28.7
132
-
133
- _Code generation performance._ Evaluated using [MBPP](https://github.com/google-research/google-research/tree/master/mbpp):
134
- | Score |
135
- | :---- |
136
- | 32.0 |
137
-
138
- ## Inference
139
-
140
- **Engine:** TensorRT-LLM
141
-
142
- **Test Hardware:** NVIDIA A100
143
-
144
- **DType:** BFloat16
145
-
146
-
147
- ## Limitations
148
-
149
- 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.
150
-
151
- ## Ethical Considerations
152
-
153
- 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.
154
-
155
- Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
156
-
157
- ## References
158
  * [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
+ # 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, number of attention heads, 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
+ Pull requests
52
+ to support this model in Hugging Face Transformers are currently under review
53
+ ([#32495](https://github.com/huggingface/transformers/pull/32495) and [#32502](https://github.com/huggingface/transformers/pull/32502))
54
+ and are expected to be merged soon. In the meantime,
55
+ please follow the installation instructions below:
56
+
57
+ ```
58
+ # Fetch PR 32502
59
+ $ git clone -b suhara/llama-kv-channels --single-branch https://github.com/suhara/transformers.git && cd transformers
60
+
61
+ # Fetch changes from PR 32495
62
+ $ git fetch https://github.com/suiyoubi/transformers.git aot/head_dim_rope && git cherry-pick FETCH_HEAD --strategy-option theirs
63
+
64
+ # Install transformers
65
+ $ pip install -e .
66
+ ```
67
+ We can now run inference on this model:
68
+
69
+ ```python
70
+ import torch
71
+ from transformers import AutoTokenizer, LlamaForCausalLM
72
+
73
+ # Load the tokenizer and model
74
+ model_path = "nvidia/Llama-3.1-Minitron-4B-Width-Base"
75
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
76
+
77
+ device = 'cuda'
78
+ dtype = torch.bfloat16
79
+ model = LlamaForCausalLM.from_pretrained(model_path, torch_dtype=dtype, device_map=device)
80
+
81
+ # Prepare the input text
82
+ prompt = 'Complete the paragraph: our solar system is'
83
+ inputs = tokenizer.encode(prompt, return_tensors='pt').to(model.device)
84
+
85
+ # Generate the output
86
+ outputs = model.generate(inputs, max_length=20)
87
+
88
+ # Decode and print the output
89
+ output_text = tokenizer.decode(outputs[0])
90
+ print(output_text)
91
+ ```
92
+
93
+ ## Software Integration
94
+ **Runtime Engine(s):**
95
+ * NeMo 24.05
96
+
97
+ **Supported Hardware Microarchitecture Compatibility:** <br>
98
+ * NVIDIA Ampere
99
+ * NVIDIA Blackwell
100
+ * NVIDIA Hopper
101
+ * NVIDIA Lovelace
102
+
103
+
104
+ **[Preferred/Supported] Operating System(s):** <br>
105
+ * Linux
106
+
107
+ ## Dataset & Training
108
+
109
+ **Data Collection Method by Dataset:** Automated
110
+
111
+ **Labeling Method by Dataset:** Not Applicable
112
+
113
+ **Properties:**
114
+ 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.
115
+
116
+ **Data Freshness:** The pretraining data has a cutoff of June 2023.
117
+
118
+ ## Evaluation Results
119
+
120
+ ### Overview
121
+ _5-shot performance._ Language Understanding evaluated using [Massive Multitask Language Understanding](https://arxiv.org/abs/2009.03300):
122
+
123
+ | Average |
124
+ | :---- |
125
+ | 60.5 |
126
+
127
+ _Zero-shot performance._ Evaluated using select datasets from the [LM Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) with additions:
128
+
129
+ | HellaSwag | Winogrande | GSM8K| ARC-Challenge | XLSum |
130
+ | :---- | :---- | :---- | :---- | :---- |
131
+ | 76.1 | 73.5 | 41.2 | 55.6 | 28.7
132
+
133
+ _Code generation performance._ Evaluated using [MBPP](https://github.com/google-research/google-research/tree/master/mbpp):
134
+ | Score |
135
+ | :---- |
136
+ | 32.0 |
137
+
138
+ ## Inference
139
+
140
+ **Engine:** TensorRT-LLM
141
+
142
+ **Test Hardware:** NVIDIA A100
143
+
144
+ **DType:** BFloat16
145
+
146
+
147
+ ## Limitations
148
+
149
+ 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.
150
+
151
+ ## Ethical Considerations
152
+
153
+ 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.
154
+
155
+ Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
156
+
157
+ ## References
158
  * [Compact Language Models via Pruning and Knowledge Distillation](https://arxiv.org/abs/2407.14679)