Cette page fournit des instructions pour configurer l'utilisation de Gemma dans Colab. Certaines des
les instructions s'appliquent également
à d'autres environnements de développement.
Accéder à Gemma
Avant d'utiliser Gemma pour la première fois, vous devez demander l'accès au
via Kaggle. Dans le cadre du processus, vous devrez utiliser un Kaggle
pour accepter les règles d'utilisation et les conditions de licence de Gemma.
Si vous n'avez pas encore de compte Kaggle, vous pouvez en créer un à l'adresse
kaggle.com. Ensuite, procédez comme suit:
Remplissez le formulaire de consentement et acceptez les conditions d'utilisation.
Sélectionner un environnement d'exécution Colab
Pour suivre un tutoriel Colab, vous devez disposer d'un environnement d'exécution Colab offrant
pour exécuter le modèle Gemma. Pour commencer, vous pouvez :
utilisez un GPU T4:
En haut à droite de la fenêtre Colab, sélectionnez ▾.
(Options de connexion supplémentaires).
Sélectionnez Modifier le type d'environnement d'exécution.
Dans Accélérateur matériel, sélectionnez GPU T4.
Configurer votre clé API
Pour utiliser Gemma, vous devez fournir votre nom d'utilisateur Kaggle et une clé d'API Kaggle. À
générer et configurer ces valeurs, procédez comme suit:
Pour générer une clé API Kaggle, accédez à l'onglet Compte de votre utilisateur Kaggle
profil, puis sélectionnez Créer un jeton. Cela déclenchera le téléchargement
kaggle.json contenant vos identifiants d'API.
Ouvrez kaggle.json dans un éditeur de texte. Le contenu doit se présenter comme suit :
ceci:
Dans Colab, sélectionnez Secrets (Helvetica) et ajoutez votre nom d'utilisateur Kaggle et Kaggle.
Clé API. Stockez votre nom d'utilisateur sous le nom KAGGLE_USERNAME et utilisez votre API.
sous le nom KAGGLE_KEY.
Vous êtes maintenant prêt à effectuer les étapes de configuration restantes dans Colab. Si vous utilisez
suivez un tutoriel Colab, accédez à Colab et définissez les variables d'environnement.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2024/08/05 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2024/08/05 (UTC)."],[],[],null,["# Gemma setup\n\nThis page provides setup instructions for using Gemma in Colab. Some of the\ninstructions are applicable to other development environments as well.\n\nGet access to Gemma\n-------------------\n\nBefore using Gemma for the first time, you must request access to the\nmodel through Kaggle. As part of the process, you'll have to use a Kaggle\naccount to accept the Gemma use policy and license terms.\n\nIf you don't already have a Kaggle account, you can register for one at\n[kaggle.com](https://www.kaggle.com). Then complete the following steps:\n\n1. Go to the [Gemma model card](https://www.kaggle.com/models/google/gemma) and select **Request Access**.\n2. Complete the consent form and accept the terms and conditions.\n\nSelect a Colab runtime\n----------------------\n\nTo complete a Colab tutorial, you must have a Colab runtime with sufficient\nresources to run the Gemma model. To [get started](./get_started), you can\nuse a T4 GPU:\n\n1. In the upper-right of the Colab window, select ▾ (**Additional connection options**).\n2. Select **Change runtime type**.\n3. Under **Hardware accelerator** , select **T4 GPU**.\n\nConfigure your API key\n----------------------\n\nTo use Gemma, you must provide your Kaggle username and a Kaggle API key. To\ngenerate and configure these values, follow these steps:\n\n1. To generate a Kaggle API key, go to the **Account** tab of your Kaggle [user\n profile](https://www.kaggle.com/settings) and select **Create New Token** . This will trigger the download of a `kaggle.json` file containing your API credentials.\n2. Open `kaggle.json` in a text editor. The contents should look something like\n this:\n\n {\"username\":\"your_username\",\"key\":\"012345678abcdef012345678abcdef1a\"}\n\n3. In Colab, select **Secrets** (🔑) and add your Kaggle username and Kaggle\n API key. Store your username under the name `KAGGLE_USERNAME` and your API\n key under the name `KAGGLE_KEY`.\n\n | **Note:** Kaggle notebooks have a key storage feature under **Add-ons** \\\u003e **Secrets**, along with instructions for accessing stored keys.\n\nNow you're ready to complete the remaining setup steps in Colab. If you're\nworking through a Colab tutorial, go to Colab and set the environment variables.\n| **Tip:** As an alternative to setting environment variables, you can use `kagglehub` to [authenticate](https://github.com/Kaggle/kagglehub?tab=readme-ov-file#authenticate)."]]