Skip to content

Instantly share code, notes, and snippets.

@xquery
Created May 17, 2024 15:31
Show Gist options
  • Save xquery/fb7c2b967dea93e10476dea06672bc3c to your computer and use it in GitHub Desktop.
Save xquery/fb7c2b967dea93e10476dea06672bc3c to your computer and use it in GitHub Desktop.
fine tune a model with instructlab (https://github.com/instructlab/instructlab)
> mkdir instructlab
> cd instructlab
# install instructlab
> python3 -m venv --upgrade-deps venv
> source venv/bin/activate
> pip cache remove llama_cpp_python
> pip install git+https://github.com/instructlab/instructlab.git@stable -C cmake.args="-DLLAMA_CUBLAS=on"
# if you dont have GPU you can go here https://github.com/instructlab/instructlab?tab=readme-ov-file#-installing-ilab to use your measly CPU
# initialise ilab
> ilab init
# download base model
> ilab download
# add to the existing taxonomy
> mkdir taxonomy/compositional_skills/linguistics/classification/good_pizza
# create taxonomy/compositional_skills/linguistics/classification/good_pizza/qna.yaml
qna.yaml
-----
created_by: Jim Fuller
seed_examples:
- answer: 'bad pizza'
question: 'Hawiaan pizza'
- answer: 'good pizza'
question: 'Anchovy pizza'
- answer: 'good pizza'
question: 'Pepperoni pizza'
-----
# dont overthink adding skills ... its as easy as that, generate step will create a lot more synthetic data based on your few examples
# make sure the yaml is ok
> ilab diff
# generate synthetic training data
> ilab generate
# fine tune the base model
> ilab train
> ilab serve --model-path <resultant_model_from_train_step>
# provides REST API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment