Text Generation
PEFT
TensorBoard
Safetensors
Transformers
mistral
axolotl
lora
conversational
text-generation-inference
Instructions to use TeamPV/mistral-nemo-onr-sft-singleGPU with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use TeamPV/mistral-nemo-onr-sft-singleGPU with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-Nemo-Instruct-2407") model = PeftModel.from_pretrained(base_model, "TeamPV/mistral-nemo-onr-sft-singleGPU") - Transformers
How to use TeamPV/mistral-nemo-onr-sft-singleGPU with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TeamPV/mistral-nemo-onr-sft-singleGPU") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TeamPV/mistral-nemo-onr-sft-singleGPU") model = AutoModelForCausalLM.from_pretrained("TeamPV/mistral-nemo-onr-sft-singleGPU", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TeamPV/mistral-nemo-onr-sft-singleGPU with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TeamPV/mistral-nemo-onr-sft-singleGPU" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TeamPV/mistral-nemo-onr-sft-singleGPU", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TeamPV/mistral-nemo-onr-sft-singleGPU
- SGLang
How to use TeamPV/mistral-nemo-onr-sft-singleGPU 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 "TeamPV/mistral-nemo-onr-sft-singleGPU" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TeamPV/mistral-nemo-onr-sft-singleGPU", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "TeamPV/mistral-nemo-onr-sft-singleGPU" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TeamPV/mistral-nemo-onr-sft-singleGPU", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TeamPV/mistral-nemo-onr-sft-singleGPU with Docker Model Runner:
docker model run hf.co/TeamPV/mistral-nemo-onr-sft-singleGPU
Upload folder using huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: peft
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
base_model: mistralai/Mistral-Nemo-Instruct-2407
|
| 5 |
+
tags:
|
| 6 |
+
- axolotl
|
| 7 |
+
- base_model:adapter:mistralai/Mistral-Nemo-Instruct-2407
|
| 8 |
+
- lora
|
| 9 |
+
- transformers
|
| 10 |
+
datasets:
|
| 11 |
+
- TeamPV/distractors-onr-v2
|
| 12 |
+
pipeline_tag: text-generation
|
| 13 |
+
model-index:
|
| 14 |
+
- name: mistral-nemo-onr-sft
|
| 15 |
+
results: []
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 19 |
+
should probably proofread and complete it, then remove this comment. -->
|
| 20 |
+
|
| 21 |
+
[<img src="https://raw.githubusercontent.com/axolotl-ai-cloud/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/axolotl-ai-cloud/axolotl)
|
| 22 |
+
<details><summary>See axolotl config</summary>
|
| 23 |
+
|
| 24 |
+
axolotl version: `0.13.0.dev0`
|
| 25 |
+
```yaml
|
| 26 |
+
base_model: mistralai/Mistral-Nemo-Instruct-2407
|
| 27 |
+
|
| 28 |
+
##uncomment for 2 GPU. More than two require more settings.
|
| 29 |
+
#deepspeed: deepspeed_configs/zero1.json
|
| 30 |
+
|
| 31 |
+
# Model quantization for qLoRA
|
| 32 |
+
bnb_config_kwargs:
|
| 33 |
+
bnb_4bit_compute_dtype: bfloat16
|
| 34 |
+
bnb_4bit_quant_type: nf4
|
| 35 |
+
bnb_4bit_use_double_quant: true
|
| 36 |
+
|
| 37 |
+
seed: 42 # do not change
|
| 38 |
+
val_set_size: 0.01 # Use 1% of the dataset for validation; no pre-split in dataset
|
| 39 |
+
## For other datasets set to ratio based on dataset size, 100k - 0.01, ..., 100 - 0.05
|
| 40 |
+
datasets:
|
| 41 |
+
- path: TeamPV/distractors-onr-v2
|
| 42 |
+
split: train
|
| 43 |
+
type: chat_template
|
| 44 |
+
conversation: messages # Your dataset has 'messages' field
|
| 45 |
+
|
| 46 |
+
chat_template: tokenizer_default # Use model's built-in chat template
|
| 47 |
+
|
| 48 |
+
eval_sample_packing: false # Only 70b model can handle this
|
| 49 |
+
eval_batch_size: 14 # TUNE THIS to achieve ~70+ GB CRAM usage on H100 (often same value as micro_batch_size in pre-trainer config)
|
| 50 |
+
evals_per_epoch: 5
|
| 51 |
+
# early_stopping_patience: 3
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
# Tokenization
|
| 55 |
+
sequence_len: 3000 # CRITICAL to check
|
| 56 |
+
pad_to_sequence_len: true
|
| 57 |
+
sample_packing: false # this will make small models go insane.
|
| 58 |
+
|
| 59 |
+
special_tokens:
|
| 60 |
+
pad_token: "</s>"
|
| 61 |
+
|
| 62 |
+
# LoRA/DoRA
|
| 63 |
+
adapter: lora
|
| 64 |
+
lora_r: 32 # 70B will require 128. Memory cost, workarounds exist.
|
| 65 |
+
lora_alpha: 64 # 2x r
|
| 66 |
+
lora_dropout: 0.05
|
| 67 |
+
lora_target_modules: # This is basic full coverage. For LLAMA use unsloth.
|
| 68 |
+
- q_proj
|
| 69 |
+
- k_proj
|
| 70 |
+
- v_proj
|
| 71 |
+
- o_proj
|
| 72 |
+
- up_proj
|
| 73 |
+
- down_proj
|
| 74 |
+
- gate_proj
|
| 75 |
+
peft_use_dora: false # 2x slower training, but allowed to drop r x4
|
| 76 |
+
output_dir: /model_out/mistral-nemo-12b_sft # change this
|
| 77 |
+
use_tensorboard: true
|
| 78 |
+
|
| 79 |
+
# Training
|
| 80 |
+
micro_batch_size: 9 # TUNE THIS to achieve ~70+ GB VRAM usage on H100
|
| 81 |
+
gradient_accumulation_steps: 1 # Not worth it under 12B on h100. 70B will be mandatory.
|
| 82 |
+
num_epochs: 4 # SFT is 4-5
|
| 83 |
+
learning_rate: 0.00005
|
| 84 |
+
lr_scheduler: cosine
|
| 85 |
+
warmup_ratio: 0.10
|
| 86 |
+
|
| 87 |
+
# Optimizer
|
| 88 |
+
# optimizer: adamw_torch_fused
|
| 89 |
+
optimizer: adamw_bnb_8bit
|
| 90 |
+
bf16: true
|
| 91 |
+
fp16: false
|
| 92 |
+
tf32: true # H100 parameter
|
| 93 |
+
|
| 94 |
+
# Attention
|
| 95 |
+
flash_attention: true
|
| 96 |
+
|
| 97 |
+
# Memory
|
| 98 |
+
gradient_checkpointing: true
|
| 99 |
+
gradient_checkpointing_kwargs:
|
| 100 |
+
use_reentrant: false
|
| 101 |
+
|
| 102 |
+
# Checkpointing
|
| 103 |
+
save_first_step: true
|
| 104 |
+
saves_per_epoch: 2
|
| 105 |
+
save_total_limit: 10
|
| 106 |
+
load_best_model_at_end: true
|
| 107 |
+
|
| 108 |
+
# Logging
|
| 109 |
+
logging_steps: 50
|
| 110 |
+
|
| 111 |
+
# HuggingFace Hub upload
|
| 112 |
+
hub_model_id: TeamPV/mistral-nemo-onr-sft # ALWAYS CHANGE
|
| 113 |
+
hub_strategy: every_save # Options: end, every_save, checkpoint, all_checkpoints
|
| 114 |
+
hf_use_auth_token: true
|
| 115 |
+
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
</details><br>
|
| 119 |
+
|
| 120 |
+
# mistral-nemo-onr-sft
|
| 121 |
+
|
| 122 |
+
This model is a fine-tuned version of [mistralai/Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407) on the TeamPV/distractors-onr-v2 dataset.
|
| 123 |
+
It achieves the following results on the evaluation set:
|
| 124 |
+
- Loss: 1.0149
|
| 125 |
+
- Memory/max Active (gib): 77.11
|
| 126 |
+
- Memory/max Allocated (gib): 77.11
|
| 127 |
+
- Memory/device Reserved (gib): 77.96
|
| 128 |
+
|
| 129 |
+
## Model description
|
| 130 |
+
|
| 131 |
+
More information needed
|
| 132 |
+
|
| 133 |
+
## Intended uses & limitations
|
| 134 |
+
|
| 135 |
+
More information needed
|
| 136 |
+
|
| 137 |
+
## Training and evaluation data
|
| 138 |
+
|
| 139 |
+
More information needed
|
| 140 |
+
|
| 141 |
+
## Training procedure
|
| 142 |
+
|
| 143 |
+
### Training hyperparameters
|
| 144 |
+
|
| 145 |
+
The following hyperparameters were used during training:
|
| 146 |
+
- learning_rate: 5e-05
|
| 147 |
+
- train_batch_size: 9
|
| 148 |
+
- eval_batch_size: 14
|
| 149 |
+
- seed: 42
|
| 150 |
+
- optimizer: Use OptimizerNames.ADAMW_BNB with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 151 |
+
- lr_scheduler_type: cosine
|
| 152 |
+
- lr_scheduler_warmup_steps: 4393
|
| 153 |
+
- training_steps: 43939
|
| 154 |
+
|
| 155 |
+
### Training results
|
| 156 |
+
|
| 157 |
+
| Training Loss | Epoch | Step | Validation Loss | Active (gib) | Allocated (gib) | Reserved (gib) |
|
| 158 |
+
|:-------------:|:-----:|:-----:|:---------------:|:------------:|:---------------:|:--------------:|
|
| 159 |
+
| No log | 0 | 0 | 1.9760 | 76.86 | 76.86 | 77.68 |
|
| 160 |
+
| 1.1451 | 0.2 | 2197 | 1.1194 | 77.11 | 77.11 | 77.96 |
|
| 161 |
+
| 1.0682 | 0.4 | 4394 | 1.0709 | 77.11 | 77.11 | 77.96 |
|
| 162 |
+
| 1.0512 | 0.6 | 6591 | 1.0371 | 77.11 | 77.11 | 77.96 |
|
| 163 |
+
| 1.0213 | 0.8 | 8788 | 1.0147 | 77.11 | 77.11 | 77.96 |
|
| 164 |
+
| 1.0041 | 1.0 | 10985 | 0.9990 | 77.11 | 77.11 | 77.96 |
|
| 165 |
+
| 0.9459 | 1.2 | 13182 | 0.9950 | 77.11 | 77.11 | 77.96 |
|
| 166 |
+
| 0.9329 | 1.4 | 15379 | 0.9897 | 77.11 | 77.11 | 77.96 |
|
| 167 |
+
| 0.9445 | 1.6 | 17576 | 0.9783 | 77.11 | 77.11 | 77.96 |
|
| 168 |
+
| 0.9434 | 1.8 | 19773 | 0.9706 | 77.11 | 77.11 | 77.96 |
|
| 169 |
+
| 0.88 | 2.0 | 21970 | 0.9620 | 77.11 | 77.11 | 77.96 |
|
| 170 |
+
| 0.8008 | 2.2 | 24167 | 0.9877 | 77.11 | 77.11 | 77.96 |
|
| 171 |
+
| 0.7725 | 2.4 | 26364 | 0.9867 | 77.11 | 77.11 | 77.96 |
|
| 172 |
+
| 0.781 | 2.6 | 28561 | 0.9801 | 77.11 | 77.11 | 77.96 |
|
| 173 |
+
| 0.7722 | 2.8 | 30758 | 0.9785 | 77.11 | 77.11 | 77.96 |
|
| 174 |
+
| 0.7704 | 3.0 | 32955 | 0.9736 | 77.11 | 77.11 | 77.96 |
|
| 175 |
+
| 0.6672 | 3.2 | 35152 | 1.0137 | 77.11 | 77.11 | 77.96 |
|
| 176 |
+
| 0.6657 | 3.4 | 37349 | 1.0155 | 77.11 | 77.11 | 77.96 |
|
| 177 |
+
| 0.6744 | 3.6 | 39546 | 1.0152 | 77.11 | 77.11 | 77.96 |
|
| 178 |
+
| 0.6398 | 3.8 | 41743 | 1.0149 | 77.11 | 77.11 | 77.96 |
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
### Framework versions
|
| 182 |
+
|
| 183 |
+
- PEFT 0.17.1
|
| 184 |
+
- Transformers 4.57.1
|
| 185 |
+
- Pytorch 2.8.0+cu128
|
| 186 |
+
- Datasets 4.0.0
|
| 187 |
+
- Tokenizers 0.22.1
|