En esta página, se proporcionan instrucciones de configuración para usar Gemma en Colab. Algunos de los
las instrucciones también se aplican a otros entornos de desarrollo.
Obtén acceso a Gemma
Antes de usar Gemma por primera vez, debes solicitar acceso al
con Kaggle. Como parte del proceso, tendrás que usar un Kaggle
para aceptar la política de uso y las condiciones de la licencia de Gemma.
Si aún no tienes una cuenta de Kaggle, puedes registrarte para obtener una en
kaggle.com. A continuación, completa los siguientes pasos:
Completa el formulario de consentimiento y acepta los Términos y Condiciones.
Selecciona un entorno de ejecución de Colab
Para completar un instructivo de Colab, debes tener un entorno de ejecución con suficientes
para ejecutar el modelo Gemma. Para comenzar, puedes hacer lo siguiente:
usar una GPU T4:
En la esquina superior derecha de la ventana de Colab, selecciona ▾
(Opciones de conexión adicionales).
Selecciona Cambiar tipo de entorno de ejecución.
En Acelerador de hardware, selecciona GPU T4.
Cómo configurar tu clave de API
Para usar Gemma, debes proporcionar tu nombre de usuario y una clave de API de Kaggle. Para
generar y configurar estos valores, sigue estos pasos:
Para generar una clave API Kaggle, dirígete a la pestaña Cuenta de tu usuario de Kaggle
perfil y selecciona Crear token nuevo. Esto activará la descarga de un
archivo kaggle.json que contiene tus credenciales de API.
Abre kaggle.json en un editor de texto. El contenido debería ser similar a lo siguiente:
esto:
En Colab, selecciona Secrets (bookmark) y agrega tu nombre de usuario de Kaggle y Kaggle.
Clave de API. Almacena tu nombre de usuario con el nombre KAGGLE_USERNAME y tu API
con el nombre KAGGLE_KEY.
Ya tienes todo listo para completar los pasos de configuración restantes en Colab. Si estás
un instructivo de Colab, ve a Colab y configura las variables de entorno.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 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)."]]