Instructions to use nvidia/Minitron-8B-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/Minitron-8B-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nvidia/Minitron-8B-Base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nvidia/Minitron-8B-Base") model = AutoModelForCausalLM.from_pretrained("nvidia/Minitron-8B-Base") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use nvidia/Minitron-8B-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nvidia/Minitron-8B-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Minitron-8B-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nvidia/Minitron-8B-Base
- SGLang
How to use nvidia/Minitron-8B-Base with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "nvidia/Minitron-8B-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Minitron-8B-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "nvidia/Minitron-8B-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Minitron-8B-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nvidia/Minitron-8B-Base with Docker Model Runner:
docker model run hf.co/nvidia/Minitron-8B-Base
Model name change
Browse files- README.md +7 -7
- config.json +1 -1
README.md
CHANGED
|
@@ -7,7 +7,7 @@ license_link: >-
|
|
| 7 |
|
| 8 |
# Model Overview
|
| 9 |
|
| 10 |
-
|
| 11 |
|
| 12 |
Deriving the Minitron 8B and 4B models from the base 15B model using our approach requires up to **40x fewer training tokens** per model compared to training from scratch; this results in **compute cost savings of 1.8x** for training the full model family (15B, 8B, and 4B). Minitron models exhibit up to a 16% improvement in MMLU scores compared to training from scratch, perform comparably to other community models such as Mistral 7B, Gemma 7B and Llama-3 8B, and outperform state-of-the-art compression techniques from the literature. Please refer to our [arXiv paper](https://arxiv.org/abs/2407.14679) for more details.
|
| 13 |
|
|
@@ -15,15 +15,15 @@ This model is for research and development only.
|
|
| 15 |
|
| 16 |
**Model Developer:** NVIDIA
|
| 17 |
|
| 18 |
-
**Model Dates:**
|
| 19 |
|
| 20 |
## License
|
| 21 |
|
| 22 |
-
|
| 23 |
|
| 24 |
## Model Architecture
|
| 25 |
|
| 26 |
-
|
| 27 |
It also uses Grouped-Query Attention (GQA) and Rotary Position Embeddings (RoPE).
|
| 28 |
|
| 29 |
**Architecture Type:** Transformer Decoder (auto-regressive language model)
|
|
@@ -55,14 +55,14 @@ $ git clone -b aot/head_dim_rope --single-branch https://github.com/suiyoubi/tra
|
|
| 55 |
$ pip install -e .
|
| 56 |
```
|
| 57 |
|
| 58 |
-
The following code provides an example of how to load the
|
| 59 |
|
| 60 |
```python
|
| 61 |
import torch
|
| 62 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 63 |
|
| 64 |
# Load the tokenizer and model
|
| 65 |
-
model_path = "nvidia/
|
| 66 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 67 |
|
| 68 |
device='cuda'
|
|
@@ -87,7 +87,7 @@ print(output_text)
|
|
| 87 |
|
| 88 |
**Labeling Method:** Not Applicable
|
| 89 |
|
| 90 |
-
**Properties:** The training corpus for
|
| 91 |
|
| 92 |
**Data Freshness:** The pretraining data has a cutoff of June 2023.
|
| 93 |
|
|
|
|
| 7 |
|
| 8 |
# Model Overview
|
| 9 |
|
| 10 |
+
Minitron-8B-Base is a large language model (LLM) obtained by pruning Nemotron-4 15B; specifically, we prune model embedding size, number of attention heads, and MLP intermediate dimension. 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.
|
| 11 |
|
| 12 |
Deriving the Minitron 8B and 4B models from the base 15B model using our approach requires up to **40x fewer training tokens** per model compared to training from scratch; this results in **compute cost savings of 1.8x** for training the full model family (15B, 8B, and 4B). Minitron models exhibit up to a 16% improvement in MMLU scores compared to training from scratch, perform comparably to other community models such as Mistral 7B, Gemma 7B and Llama-3 8B, and outperform state-of-the-art compression techniques from the literature. Please refer to our [arXiv paper](https://arxiv.org/abs/2407.14679) for more details.
|
| 13 |
|
|
|
|
| 15 |
|
| 16 |
**Model Developer:** NVIDIA
|
| 17 |
|
| 18 |
+
**Model Dates:** Minitron-8B-Base was trained between February 2024 and June 2024.
|
| 19 |
|
| 20 |
## License
|
| 21 |
|
| 22 |
+
Minitron-8B-Base 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 |
+
Minitron-8B-Base uses a model embedding size of 4096, 48 attention heads, and an MLP intermediate dimension of 16384.
|
| 27 |
It also uses Grouped-Query Attention (GQA) and Rotary Position Embeddings (RoPE).
|
| 28 |
|
| 29 |
**Architecture Type:** Transformer Decoder (auto-regressive language model)
|
|
|
|
| 55 |
$ pip install -e .
|
| 56 |
```
|
| 57 |
|
| 58 |
+
The following code provides an example of how to load the Minitron-8B model and use it to perform text generation.
|
| 59 |
|
| 60 |
```python
|
| 61 |
import torch
|
| 62 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 63 |
|
| 64 |
# Load the tokenizer and model
|
| 65 |
+
model_path = "nvidia/Minitron-8B-Base"
|
| 66 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 67 |
|
| 68 |
device='cuda'
|
|
|
|
| 87 |
|
| 88 |
**Labeling Method:** Not Applicable
|
| 89 |
|
| 90 |
+
**Properties:** The training corpus for Minitron-8B-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.
|
| 91 |
|
| 92 |
**Data Freshness:** The pretraining data has a cutoff of June 2023.
|
| 93 |
|
config.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "nvidia/
|
| 3 |
"architectures": [
|
| 4 |
"NemotronForCausalLM"
|
| 5 |
],
|
|
|
|
| 1 |
{
|
| 2 |
+
"_name_or_path": "nvidia/Minitron-8B-Base",
|
| 3 |
"architectures": [
|
| 4 |
"NemotronForCausalLM"
|
| 5 |
],
|