Instructlab Cheatsheet
Instructlab Cheatsheet
// 1. Install dependencies and clone the // 6. Generate synthetic data pairs using LLM
taxonomy # This will use the LLM specified in the config
# Install the instructlab library file to generate synthetic instruction pairs, by
pip install instructlab default it’ll create 100 examples but this can be
# The taxonomy gives you a structured format changed. MAKE SURE TO VALIDATE THE DATA
TE
for managing your training data BEFORE TRAINING...PLEASE ! 🥲
git clone ilab data generate
https://github.com/instructlab/taxonomy
OT
// 7. train the model
// 2. Initialize Instructlab # This will kick off the training of a new LoRA for
# This creates a baseline config.yaml file where and will save the trained adapter in the
you can specify which models to use for instructlab-merlinite-7b-lab-trained directory.
training, synethetic data generation and serving ilab model train
N
ilab config init # If you want to change how long you train the
model for you can set the --iters flag e.g.
RE
// 3. Download baseline modelmodels training for 1000 iterations.
# Note that the base model that this will ilab model train --iters 1000
download is defined in the config # Also if you get stuck and need help you can
ilab model download run the cli command with the --help flag
ilab model train --help
S
// 4. Spin up the API and chat with it
# Run this in one terminal to host the API using // 8. Quantize the Model
LA
an OpenAI compatible web server # This automatically quantizes your model for
ilab model serve more efficient serving and inference.
# Chat with it using another terminal, note you ilab model convert
can also hit the API directly
HO
ilab model chat // 9. Serve and chat with the trained model
# Serve the trained model by specifying the
// 5. Upload your dataset into a markdown math to the quantized model
format and validate ilab model serve --model-path instructlab-
# I used GitHub, this is an example: merlinite-7b-lab-trained/instructlab-merlinite-
IC
file that points to the dataset example YAML: ilab model chat -gm -m instructlab-merlinite-7b-
https://github.com/nicknochnack/testdata/blob lab-trained/instructlab-merlinite-7b-lab-
/main/qna.yaml Q4_K_M.gguf
NICHOLAS RENOTTE