Learn how to fine-tune LLaMA 2 models using OVHcloud AI Notebooks and a single GPU. This allows you to retrain the model to suit your needs using your own dataset. We will use QLoRA, a highly efficient LLM fine-tuning technique.
On July 18, 2023, Meta released LLaMA 2, the latest version of their open-source Large Language Model (LLM).
Trained between January 2023 and July 2023 on 2 trillion tokens, LLaMA 2 outperforms other LLMs on many benchmarks, including reasoning, coding, proficiency, and knowledge tests. This release comes in different flavors, with parameter sizes of 7B, 13B, and a mind-blowing 70B. Models are intended for free for both commercial and research use in English.
Requirements
- Access to the OVHcloud Control Panel
- An AI Notebooks project created inside a Public Cloud project in your OVHcloud account
- A user for AI Notebooks
To access LLaMA 2 models, you will also need to follow the requirements indicated in the notebook.
Instructions
You can launch the notebook from the OVHcloud Control Panel or via the ovhai CLI.
Launching a Jupyter notebook with "Conda" via UI (Control Panel)
To launch your notebook from the OVHcloud Control Panel, refer to the following steps.
Code editor
Choose the Jupyterlab
code editor.
Framework
In this tutorial, the conda
framework is used.
Resources
Using at least one GPU is mandatory since fine-tuning LLMs is an intensive task.
Launching a Jupyter notebook with "conda" via CLI
If you have not used our CLI yet, follow this guide to install it.
If you want to launch your notebook with the OVHcloud AI CLI, choose the jupyterlab
editor and the conda
framework.
To access the different versions of conda
available, run the following command:
If you do not specify a version, your notebook starts with the default version of conda
.
You will also need to choose the number of GPUs to use in your notebook using <nb-gpus>
.
To launch your notebook, run the following command:
You can then reach your notebook’s URL once the notebook is running.
Accessing the notebooks
Once our AI examples repository has been cloned in your environment, find the fine-tuning notebook tutorial by following this path: ai-training-examples
> notebooks
> natural-language-processing
> llm/miniconda/llama2-fine-tuning
> llama_2_finetuning.ipynb
.
A direct link to the notebook can be found here.
Go further
Don't forget to keep an eye on our upcoming tutorials, where we will be deploying our fine-tuned LLaMA model on AI Deploy for inference!
For more information and tutorials, please see our other AI & Machine Learning support guides or explore the guides for other OVHcloud products and services.
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.