Welcome to Demo for InstructLab CLI¶
A tool to help you contribute to InstructLab Taxonomy.
It allows you to locally
Check the behavior of the latest Merlinite-7B model
Iterate seed examples for synthetic data generation
Validate the synthetic data via local LoRA training
This demo walks through the functionality step by step.
For more info, see the CLI repo.
Step 0: Initial setup¶
Create workspace and virtual environment
python3 -m venv workspace/venv
cd workspace
source venv/bin/activate.fish
Install CLI
pip install instructlab
Initialize workspace
ilab config init
Step 1: Check current model behavior¶
Download current model
ilab model download
Start chat
ilab model chat
Trying…
how to initialize a workspace using the CLI of InstructLab?
…but the answer is wrong
Step 2: Write seed examples for SDG¶
Check current status of taxonomy
ilab taxonomy diff
Check YAML file to add
cat ../qna.yaml
Add file to taxonomy and check updated status of taxonomy
mkdir -p taxonomy/knowledge/instructlab/cli
cp ../qna.yaml taxonomy/knowledge/instructlab/cli/qna.yaml
ilab taxonomy diff
Step 3: Generate synthetic data¶
Generate 25 synthetic samples
ilab data generate --num-instructions 25
Here we use 25 for demo purpose only.
Usually we recommend more samples (e.g. 100).
It takes a while, feel free to fast-forward if you are watching the recording.
Check output
ls
ls generated
Step 4: Update model via LoRA training¶
Perform Q-LoRA for 100 iterations
ilab model train --iters 100
Here we use 100 for this particular demo.
The actual iterations needed depends on the complexity of the data.
It takes a while, feel free to fast-forward if you are watching the recording.
Check output
ls
ls instructlab-merlinite-7b-lab-mlx-q
Step 5: Check before/after behavior¶
Run old/new model on test data
ilab model test
Step 6: Interact with updated model¶
Convert updated model to GGUF
ilab model convert --model-dir instructlab-merlinite-7b-lab-mlx-q
Serve updated model and chat
ilab model serve --model-path instructlab-merlinite-7b-lab-mlx-q-fused-pt/*-Q4_K_M.gguf &
ilab model chat
Trying again…
how to initialize a workspace using the CLI of InstructLab?
…and the answer is now correct!
Step -1: Make contribution to taxonomy¶
Commit change and push to fork
cd taxonomy
git status
git remote add xukai92 https://github.com/instructlab/taxonomy.git
git add knowledge/instructlab/cli
git commit -sm "feat(knowledge): InstructLab CLI usage"
git checkout -b demo
git push --set-upstream xukai92 demo
Now, you can go creating a pull request on the taxonomy repository!
For more info, see the CLI repo.