bahree/ModelAdaptationBook
Model Adaptation Book — companion models
Trained artifacts for the book LLM Customization and Fine-Tuning: Adaptation, Distillation, and Alignment (Manning). Code: https://github.com/bahree/ModelAdaptationBook
All are adaptations of Qwen/Qwen3-4B-Instruct-2507 on a real IT-support dataset: Stack Exchange IT Q&A (Super User, Ask Ubuntu, Server Fault; CC-BY-SA-4.0) plus a small Databricks Dolly slice (CC-BY-SA-3.0) for general-capability retention. Each chapter's artifact is a subfolder, so you can follow along on any machine (including Apple Silicon) by pulling a trained model and running inference/eval, without training it yourself.
Load a full model:
from transformers import AutoModelForCausalLM
m = AutoModelForCausalLM.from_pretrained("bahree/ModelAdaptationBook", subfolder="ch6-sft")Load an adapter (on its base):
from transformers import AutoModelForCausalLM
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B-Instruct-2507")
m = PeftModel.from_pretrained(base, "bahree/ModelAdaptationBook", subfolder="ch5-lora")Training these needs a CUDA 24 GB+ GPU (and the Ch8 full DPO uses multiple GPUs; the ch8-dpo-lora adapter is the single-card alternative). Inference and evaluation fit a single smaller GPU or Apple Silicon (MPS). See the book repo for exact commands, datasets, and full attribution.
