این صفحه دستورالعمل های راه اندازی برای استفاده از Gemma در Colab را ارائه می دهد. برخی از دستورالعمل ها برای سایر محیط های توسعه نیز قابل اجرا هستند.
به Gemma دسترسی پیدا کنید
قبل از استفاده از Gemma برای اولین بار، باید از طریق Kaggle درخواست دسترسی به مدل را بدهید. به عنوان بخشی از فرآیند، باید از یک حساب Kaggle برای پذیرش خط مشی استفاده از Gemma و شرایط مجوز استفاده کنید.
اگر قبلاً یک حساب Kaggle ندارید، می توانید برای آن در kaggle.com ثبت نام کنید. سپس مراحل زیر را انجام دهید:
به کارت مدل Gemma بروید و درخواست دسترسی را انتخاب کنید.
فرم رضایت نامه را تکمیل کنید و شرایط و ضوابط را بپذیرید.
یک زمان اجرا Colab را انتخاب کنید
برای تکمیل یک آموزش Colab، باید یک زمان اجرا Colab با منابع کافی برای اجرای مدل Gemma داشته باشید. برای شروع ، می توانید از یک GPU T4 استفاده کنید:
در سمت راست بالای پنجره Colab، ▾ ( گزینه های اتصال اضافی ) را انتخاب کنید.
تغییر نوع زمان اجرا را انتخاب کنید.
در بخش شتاب دهنده سخت افزار ، GPU T4 را انتخاب کنید.
کلید API خود را پیکربندی کنید
برای استفاده از Gemma، باید نام کاربری Kaggle و یک کلید Kaggle API ارائه دهید. برای تولید و پیکربندی این مقادیر، مراحل زیر را دنبال کنید:
برای ایجاد یک کلید Kaggle API، به تب Accountپروفایل کاربری Kaggle خود بروید و Create New Token را انتخاب کنید. با این کار دانلود فایل kaggle.json حاوی اطلاعات کاربری API شما راه اندازی می شود.
kaggle.json در یک ویرایشگر متن باز کنید. محتوا باید چیزی شبیه به این باشد:
در Colab، Secrets (🔑) را انتخاب کنید و نام کاربری Kaggle و کلید Kaggle API را اضافه کنید. نام کاربری خود را با نام KAGGLE_USERNAME و کلید API خود را با نام KAGGLE_KEY ذخیره کنید.
اکنون برای تکمیل مراحل راه اندازی باقی مانده در Colab آماده هستید. اگر از طریق آموزش Colab کار می کنید، به Colab بروید و متغیرهای محیط را تنظیم کنید.
تاریخ آخرین بهروزرسانی 2024-08-05 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2024-08-05 بهوقت ساعت هماهنگ جهانی."],[],[],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)."]]