---
title: "AI Notebooks - Tutoriel - Fine-tuner LLaMA 2 (EN)"
description: "Fine-tuner LLaMA 2 sur votre propre dataset en utilisant un seul GPU, QLoRA et AI Notebooks afin d'exploiter pleinement son potentiel"
url: https://docs.ovhcloud.com/fr/guides/public-cloud/ai-machine-learning/ai-notebooks-tuto-fine-tune-llama-v2
lang: fr
lastUpdated: 2023-07-25
---
# AI Notebooks - Tutoriel - Fine-tuner LLaMA 2 (EN)

On July 18, 2023, [Meta](https://about.meta.com/) released [LLaMA 2](https://ai.meta.com/llama/), 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.

## Objective

The purpose of this tutorial is to show you how it is possible to fine-tune LLaMA 2 models using [OVHcloud AI Notebooks](https://www.ovhcloud.com/fr/public-cloud/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](https://arxiv.org/abs/2305.14314), a highly efficient LLM fine-tuning technique.

## Requirements

- An AI Notebooks project created inside a [Public Cloud project](https://www.ovhcloud.com/fr/public-cloud/) 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.


***

### OVHcloud Control Panel Access

- **Direct link:** <ManagerLink to="/#/pci/projects">Public Cloud Projects</ManagerLink>
- **Navigation path:** <code className="action">Public Cloud</code> > Select your project

***


## Instructions

You can launch the notebook from the OVHcloud Control Panel
 or via the ovhai [CLI](/fr/guides/public-cloud/ai-machine-learning/ai-cli-run-notebook.md)
.
### 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 do not use our CLI yet, follow [this guide](/fr/guides/public-cloud/ai-machine-learning/ai-cli-install-client.md) 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:

```console
ovhai capabilities framework get conda -o yaml
```

:::info
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:

```console
ovhai notebook run conda jupyterlab \
		--name <notebook-name> \
		--framework-version <conda-version> \
  	    --gpu <nb-gpus>
```

You can then reach your notebook’s URL once the notebook is running.

### Accessing the notebooks

Once our [AI examples repository](https://github.com/ovh/ai-training-examples/) 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`.

Direct link to the notebook can be found [here](https://github.com/ovh/ai-training-examples/blob/main/notebooks/natural-language-processing/llm/miniconda/llama2-fine-tuning/llama_2_finetuning.ipynb).

## Going 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](https://www.ovhcloud.com/fr/public-cloud/ai-deploy/) for inference!

In the meantime, we invite you to take a look at our other NLP tutorials:

- [Analyse sentiments on Tweets](/fr/guides/public-cloud/ai-machine-learning/ai-notebooks-hugging-face-sentiment-analysis.md)

- [Create a Spam classifier](/fr/guides/public-cloud/ai-machine-learning/ai-notebooks-spam-classifier.md)

- [Discover speech to text powers and use them to generate video subtitles, meeting scripts and summaries](/fr/guides/public-cloud/ai-machine-learning/ai-notebooks-speech-to-text-recognition.md)

If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link](https://www.ovhcloud.com/fr/professional-services/) to get a quote and ask our Professional Services experts for a custom analysis of your project.

## Feedback

Please send us your questions, feedback and suggestions to improve the service:

- On the OVHcloud [Discord server](https://discord.gg/ovhcloud)
