Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Speeds up QLoRA fine-tuning of Llama, Mistral, Gemma, Qwen and other LLMs with 4-bit quantization and Flash Attention.
50% 82%+32 ptsof test cases passed
Passed 18 of 22 test cases with the skill, and 11 of 22 without it.
3 of 3 safety checks passed
Not used yet
Unsloth provides 2x faster QLoRA training with 50% less memory via optimized kernels. Supports Llama, Mistral, Gemma, Qwen 2.5, DeepSeek, Phi, Yi, and Falcon with Flash Attention.
uv pip install unsloth
from unsloth import FastLanguageModel
import torch
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="unsloth/Qwen2.5-7B-Instruct-bnb-4bit",
max_seq_length=4096,
dtype=torch.bfloat16,
load_in_4bit=True,
)
model = FastLanguageModel.get_peft_model(
model, r=16, target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
lora_alpha=16, use_gradient_checkpointing="unsloth",
)
print(model.print_trainable_parameters())
FastLanguageModel.for_inference(model)
inputs = tokenizer(["Describe quantum computing."], return_tensors="pt").to("cuda")
print(tokenizer.decode(model.generate(**inputs, max_new_tokens=256)[0]))
Next to this one in the catalogue, plus more from the same author.