Na tej stronie znajdziesz instrukcje konfigurowania Gemma w Colab. Niektóre
instrukcje mają zastosowanie również do innych środowisk programistycznych.
Jak uzyskać dostęp do Gemmy
Przed pierwszym użyciem aplikacji Gemma musisz poprosić o dostęp do
za pomocą narzędzia Kaggle. Aby to zrobić, musisz użyć narzędzia Kaggle,
aby zaakceptować zasady użytkowania i warunki licencji Gemma.
Jeśli nie masz jeszcze konta Kaggle, możesz je zarejestrować na
kaggle.com. Następnie wykonaj te czynności:
Wypełnij formularz zgody i zaakceptuj Warunki korzystania z usługi.
Wybierz środowisko wykonawcze Colab
Aby wykonać samouczek Colab, musisz mieć środowisko wykonawcze Colab z wystarczającą ilością
do uruchomienia modelu Gemma. Na początek możesz:
za pomocą GPU T4:
W prawym górnym rogu okna Colab wybierz ▾
(Dodatkowe opcje połączenia).
Kliknij Zmień typ środowiska wykonawczego.
W sekcji Akcelerator sprzętowy wybierz GPU T4.
Skonfiguruj klucz interfejsu API
Aby używać Gemma, musisz podać swoją nazwę użytkownika Kaggle i klucz interfejsu API Kaggle. Do
wygenerować i skonfigurować te wartości, wykonaj te czynności:
Aby wygenerować klucz interfejsu API Kaggle, otwórz kartę Account (Konto) użytkownika Kaggle
profil i wybierz Create New Token (Utwórz nowy token). Spowoduje to pobranie
kaggle.json plik zawierający Twoje dane logowania do interfejsu API.
Otwórz plik kaggle.json w edytorze tekstu. Treść powinna wyglądać mniej więcej tak:
to:
W Colab wybierz Secrets (🔑) i dodaj swoją nazwę użytkownika Kaggle oraz Kaggle.
klucz interfejsu API. Zapisz swoją nazwę użytkownika pod nazwą KAGGLE_USERNAME i interfejsem API
pod nazwą KAGGLE_KEY.
Teraz możesz wykonać pozostałe kroki konfiguracji w Colab. Jeśli
w samouczku Colab, otwórz Colab i ustaw zmienne środowiskowe.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 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)."]]