bahree commited on
Commit
077e790
·
verified ·
1 Parent(s): 7ff6862

Model card

Browse files
Files changed (1) hide show
  1. README.md +54 -0
README.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Qwen/Qwen3-4B-Instruct-2507
4
+ library_name: peft
5
+ tags:
6
+ - lora
7
+ - sft
8
+ - dpo
9
+ - knowledge-distillation
10
+ - fine-tuning
11
+ - it-support
12
+ ---
13
+
14
+ # Model Adaptation Book — companion models
15
+
16
+ Trained artifacts for the book *LLM Customization and Fine-Tuning: Adaptation,
17
+ Distillation, and Alignment* (Manning). Code:
18
+ https://github.com/bahree/ModelAdaptationBook
19
+
20
+ All are adaptations of `Qwen/Qwen3-4B-Instruct-2507` on a real IT-support
21
+ dataset: Stack Exchange IT Q&A (Super User, Ask Ubuntu, Server Fault;
22
+ CC-BY-SA-4.0) plus a small Databricks Dolly slice (CC-BY-SA-3.0) for
23
+ general-capability retention. Each chapter's artifact is a **subfolder**, so you
24
+ can follow along on any machine (including Apple Silicon) by pulling a trained
25
+ model and running inference/eval, without training it yourself.
26
+
27
+ | Subfolder | Chapter | What | Base |
28
+ |---|---|---|---|
29
+ | `ch5-lora` | 5 | LoRA adapter | Qwen3-4B-Instruct-2507 |
30
+ | `ch6-sft` | 6 | full SFT model (standalone) | (full fine-tune) |
31
+ | `ch7-distilled` | 7 | distilled student (LoRA) | Qwen3-4B-Instruct-2507 |
32
+ | `ch8-dpo` | 8 | full DPO model (standalone) | (full fine-tune) |
33
+ | `ch8-dpo-lora` | 8 | LoRA-DPO adapter (single-card path) | `ch6-sft` |
34
+
35
+ Load a full model:
36
+
37
+ ```python
38
+ from transformers import AutoModelForCausalLM
39
+ m = AutoModelForCausalLM.from_pretrained("bahree/ModelAdaptationBook", subfolder="ch6-sft")
40
+ ```
41
+
42
+ Load an adapter (on its base):
43
+
44
+ ```python
45
+ from transformers import AutoModelForCausalLM
46
+ from peft import PeftModel
47
+ base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B-Instruct-2507")
48
+ m = PeftModel.from_pretrained(base, "bahree/ModelAdaptationBook", subfolder="ch5-lora")
49
+ ```
50
+
51
+ **Training** these needs a CUDA 24 GB+ GPU (and the Ch8 full DPO uses multiple
52
+ GPUs; the `ch8-dpo-lora` adapter is the single-card alternative). **Inference
53
+ and evaluation** fit a single smaller GPU or Apple Silicon (MPS). See the book
54
+ repo for exact commands, datasets, and full attribution.