Instructions to use ToastyPigeon/apertus-12b-instruct-1ep-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ToastyPigeon/apertus-12b-instruct-1ep-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("apertus-12b-nonzero-trained/cpt-part2-instruct-part1") model = PeftModel.from_pretrained(base_model, "ToastyPigeon/apertus-12b-instruct-1ep-lora") - Transformers
How to use ToastyPigeon/apertus-12b-instruct-1ep-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ToastyPigeon/apertus-12b-instruct-1ep-lora", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ToastyPigeon/apertus-12b-instruct-1ep-lora", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("ToastyPigeon/apertus-12b-instruct-1ep-lora", trust_remote_code=True) 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 ToastyPigeon/apertus-12b-instruct-1ep-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ToastyPigeon/apertus-12b-instruct-1ep-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ToastyPigeon/apertus-12b-instruct-1ep-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ToastyPigeon/apertus-12b-instruct-1ep-lora
- SGLang
How to use ToastyPigeon/apertus-12b-instruct-1ep-lora 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 "ToastyPigeon/apertus-12b-instruct-1ep-lora" \ --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": "ToastyPigeon/apertus-12b-instruct-1ep-lora", "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 "ToastyPigeon/apertus-12b-instruct-1ep-lora" \ --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": "ToastyPigeon/apertus-12b-instruct-1ep-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ToastyPigeon/apertus-12b-instruct-1ep-lora with Docker Model Runner:
docker model run hf.co/ToastyPigeon/apertus-12b-instruct-1ep-lora
File size: 9,283 Bytes
9f9bf08 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | ---
library_name: peft
tags:
- axolotl
- base_model:adapter:apertus-12b-nonzero-trained/cpt-part2-instruct-part1
- lora
- transformers
datasets:
- grimulkan/LimaRP-augmented
- ToastyPigeon/mixed-medical-reasoning-formatted
- ToastyPigeon/kimi-stories-instruct
- allura-org/fujin-instruct-v2
- ToastyPigeon/some-rp-extended
- allura-forge/koto-instruct-sft-nothink
base_model: apertus-12b-nonzero-trained/cpt-part2-instruct-part1
pipeline_tag: text-generation
model-index:
- name: apertus-12b-nonzero-trained/part2-instruct
results: []
---
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->
[<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)
<details><summary>See axolotl config</summary>
axolotl version: `0.13.0.dev0`
```yaml
# === Model Configuration ===
base_model: apertus-12b-nonzero-trained/cpt-part2-instruct-part1
load_in_8bit: false
load_in_4bit: false
# === HF Configuration ===
#hub_model_id: ToastyPigeon/apertus-12b-try-again-s1
#hub_strategy: "every_save"
output_dir: apertus-12b-nonzero-trained/part2-instruct
# === Wandb Tracking ===
wandb_project: ApertusV3
# wandb_entity: [WANDB_ENTITY]
wandb_name: 12b-part2-instruct
# === Training Setup ===
num_epochs: 1
micro_batch_size: 2
gradient_accumulation_steps: 16
sequence_len: 4096
#sequence_parallel_degree: 2
#heads_k_stride: 1
sample_packing: true
#pad_to_sequence_len: true
#temperature: 0.7
#max_steps: 10
# === Evaluation ===
val_set_size: 200
evals_per_epoch: 10
#eval_steps: 20
#max_steps: 60
#eval_table_size:
eval_max_new_tokens: 128
#eval_sample_packing: true
#eval_strategy: "no"
# === LoRA Configuration ===
adapter: lora
lora_model_dir:
lora_r: 128
lora_alpha: 16
lora_dropout: 0
lora_target_linear:
lora_target_modules:
# - up_proj
- down_proj
# - gate_proj
- q_proj
- v_proj
- k_proj
- o_proj
# - input_layernorm
# - post_attention_layernorm
# - embed_tokens
# - lm_head
lora_fan_in_fan_out:
peft_use_rslora: true
lora_modules_to_save:
# - embed_tokens
# - lm_head
#fix_untrained_tokens: true
#lora_mlp_kernel: true
#lora_qkv_kernel: true
#lora_o_kernel: true
#unfrozen_parameters:
# - model.layers.(2[4-9]|3[0-9]).*
# - model.layers.[0-9+].mlp.up_proj
# - model.layers.[0-9]+.mlp.down_proj
# - model.layers.[0-9+].feedforward_layernorm
# - embed_tokens
# - lm_head
# - model.layers.[0-9]+.self_attn.(q|k|v|o)_proj
# === Hyperparameter Configuration ===
#optimizer: apollo_adamw_layerwise
#warmup_steps: 0
warmup_ratio: 0.025
#optimizer: adamw_8bit
optimizer: adamw_torch_fused
#optimizer: paged_adamw_8bit
#optim_args:
# enable_stochastic_rounding: true
# enable_cautious: true
# enable_8bit: true
# Apollo-mini configuration:
#optim_args: "proj=random,rank=128,scale=128.0,scale_type=tensor,update_proj_gap=100"
# Regular Apollo configuration:
# optim_args:
#optim_target_modules: all_linear
learning_rate: 2e-5
lr_scheduler: cosine
#cosine_min_lr_ratio: 0.2
#lr_scheduler: cosine_with_min_lr
#lr_scheduler_kwargs:
# cosine_min_lr: 1e-6
weight_decay: 0.01
max_grad_norm: 2.0
#warmup_steps: 0
#warmup_ratio: 0.025
# === Data Configuration ===
#
#chat_template: jinja
chat_template: chatml
special_tokens:
eos_token: "<|im_end|>"
# eos_token: "</s>"
#tokenizer_use_mistral_common: true
shuffle_merged_datasets: true
datasets:
# - path: allura-org/the-anarchist-library
# type: completion
# split: train[:20%]
- path: grimulkan/LimaRP-augmented
type: chat_template
field_messages: conversations
message_property_mappings:
role: from
content: value
# - path: allenai/tulu-3-sft-personas-instruction-following
# type: chat_template
# split: train[:10%]
- path: ToastyPigeon/mixed-medical-reasoning-formatted
type: chat_template
data_files: mixed-medical-nothink.json
# split: train[:10%]
# - path: ToastyPigeon/steve-and-marvin
# type: completion
# data_files: marvin.json
- path: ToastyPigeon/kimi-stories-instruct
type: chat_template
# type: completion
# - path: ToastyPigeon/new-story-dataset
# type: customcompletion-regex
# type: completion
# data_files: new-story-dataset-v2.json
- path: allura-org/fujin-instruct-v2
# type: customchatml-regex
type: chat_template
field_messages: conversations
message_property_mappings:
role: from
content: value
- path: ToastyPigeon/some-rp-extended
# type: customchatml-regex
type: chat_template
field_messages: conversations
message_property_mappings:
role: from
content: value
roles_to_train: ["user","assistant"]
split: train[:30%]
# - path: Alfitaria/rosier-inf
# type: completion
# split: train[70%:]
- path: allura-forge/koto-instruct-sft-nothink
# type: customchatml-regex
type: chat_template
# split: train[:50%]
# field_messages: conversations
# message_property_mappings:
# role: from
# content: value
# - path: ToastyPigeon/SpringDragon
# type: customcompletion-regex
# type: completion
# split: train
# - path: ToastyPigeon/erotic-books-clone
# type: customcompletion-regex
# type: completion
# split: train[:50%]
# split: train[35%:45%]
# - path: ToastyPigeon/tulu-mini
# type: chat_template
dataset_prepared_path: last_run_prepared
# === Plugins ===
plugins:
- axolotl.integrations.liger.LigerPlugin
- axolotl.integrations.cut_cross_entropy.CutCrossEntropyPlugin
# === Hardware Optimization ===
#gradient_checkpointing: true
liger_rope: true
liger_rms_norm: true
liger_layer_norm: true
liger_glu_activation: true
#liger_fused_linear_cross_entropy: true
cut_cross_entropy: true
#deepspeed: ../axolotl/deepspeed_configs/zero2.json
# === FSDP Config ===
fsdp:
- full_shard
- auto_wrap
fsdp_config:
fsdp_limit_all_gathers: true
fsdp_sync_module_states: true
fsdp_offload_params: true
fsdp_activation_checkpointing: true
fsdp_use_orig_params: true
fsdp_cpu_ram_efficient_loading: true
fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
fsdp_transformer_layer_cls_to_wrap: ApertusDecoderLayer
fsdp_state_dict_type: FULL_STATE_DICT
fsdp_sharding_strategy: FULL_SHARD
#fsdp_stage: 2
#fsdp_final_state_dict_type: FULL_STATE_DICT
# === Checkpointing ===
#save_steps: 2
saves_per_epoch: 4
save_total_limit: 4
# === Advanced Settings ===
bf16: true
flash_attention: true
train_on_inputs: false
group_by_length: false
save_safetensors: true
logging_steps: 1
seed: 420
gc_steps: 10
```
</details><br>
# apertus-12b-nonzero-trained/part2-instruct
This model was trained from scratch on the grimulkan/LimaRP-augmented, the ToastyPigeon/mixed-medical-reasoning-formatted, the ToastyPigeon/kimi-stories-instruct, the allura-org/fujin-instruct-v2, the ToastyPigeon/some-rp-extended and the allura-forge/koto-instruct-sft-nothink datasets.
It achieves the following results on the evaluation set:
- Loss: 1.1911
- Memory/max Active (gib): 6.89
- Memory/max Allocated (gib): 6.88
- Memory/device Reserved (gib): 8.18
## Model description
More information needed
## Intended uses & limitations
More information needed
## Training and evaluation data
More information needed
## Training procedure
### Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 2e-05
- train_batch_size: 2
- eval_batch_size: 2
- seed: 420
- distributed_type: multi-GPU
- num_devices: 2
- gradient_accumulation_steps: 16
- total_train_batch_size: 64
- total_eval_batch_size: 4
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: cosine
- lr_scheduler_warmup_steps: 9
- training_steps: 372
### Training results
| Training Loss | Epoch | Step | Validation Loss | Active (gib) | Allocated (gib) | Reserved (gib) |
|:-------------:|:------:|:----:|:---------------:|:------------:|:---------------:|:--------------:|
| No log | 0 | 0 | 1.4636 | 6.87 | 6.87 | 8.13 |
| 1.2677 | 0.1020 | 38 | 1.3280 | 6.89 | 6.88 | 8.18 |
| 1.1286 | 0.2041 | 76 | 1.2605 | 6.89 | 6.88 | 8.18 |
| 1.159 | 0.3061 | 114 | 1.2275 | 6.89 | 6.88 | 8.18 |
| 1.0281 | 0.4081 | 152 | 1.2122 | 6.89 | 6.88 | 8.18 |
| 1.0781 | 0.5102 | 190 | 1.2033 | 6.89 | 6.88 | 8.18 |
| 1.0296 | 0.6122 | 228 | 1.1976 | 6.89 | 6.88 | 8.18 |
| 1.0756 | 0.7142 | 266 | 1.1939 | 6.89 | 6.88 | 8.18 |
| 1.1134 | 0.8162 | 304 | 1.1921 | 6.89 | 6.88 | 8.18 |
| 1.0437 | 0.9183 | 342 | 1.1911 | 6.89 | 6.88 | 8.18 |
### Framework versions
- PEFT 0.17.1
- Transformers 4.56.1
- Pytorch 2.7.1+cu126
- Datasets 4.0.0
- Tokenizers 0.22.1 |