Skip to content

Instantly share code, notes, and snippets.

@davidmezzetti
Created January 29, 2026 13:31
Show Gist options
  • Select an option

  • Save davidmezzetti/3c3492732ab46b1afe3d0fca429a462c to your computer and use it in GitHub Desktop.

Select an option

Save davidmezzetti/3c3492732ab46b1afe3d0fca429a462c to your computer and use it in GitHub Desktop.
from unsloth import FastModel
from datasets import load_dataset
from txtai.pipeline import HFTrainer
# Load training dataset
train = load_dataset(...)
# Full fine-tune (16-bit)
# Set load_in_4bit=True and trainer.lora=True to train a QLoRA model
model = FastModel.from_pretrained(path, full_finetuning=True,
load_in_4bit=False, load_in_16bit=True)
trainer = HFTrainer()
trainer(
model,
train,
task="language-generation",
per_device_train_batch_size=16,
gradient_accumulation_steps=1,
num_train_epochs=1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment