|
@@ -2,7 +2,7 @@
|
|
|
"cells": [
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 1,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -44,7 +44,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 2,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -79,7 +79,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 1,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"id": "P1PG0WSvRqVq"
|
|
|
},
|
|
@@ -93,16 +93,14 @@
|
|
|
"import torch\n",
|
|
|
"from datasets import Dataset, load_dataset\n",
|
|
|
"from huggingface_hub import notebook_login\n",
|
|
|
- "from peft import LoraConfig, PeftModel, get_peft_model, prepare_model_for_kbit_training\n",
|
|
|
+ "from peft import LoraConfig, PeftModel\n",
|
|
|
"from transformers import (\n",
|
|
|
" AutoModelForCausalLM,\n",
|
|
|
" AutoTokenizer,\n",
|
|
|
" BitsAndBytesConfig,\n",
|
|
|
- " DataCollatorForLanguageModeling,\n",
|
|
|
- " Trainer,\n",
|
|
|
" TrainingArguments,\n",
|
|
|
")\n",
|
|
|
- "from trl import DataCollatorForCompletionOnlyLM, SFTTrainer\n",
|
|
|
+ "from trl import SFTTrainer\n",
|
|
|
"\n",
|
|
|
"DEVICE = \"cuda:0\" if torch.cuda.is_available() else \"cpu\"\n",
|
|
|
"MODEL_NAME = \"meta-llama/Llama-2-7b-hf\""
|
|
@@ -130,7 +128,7 @@
|
|
|
"id": "Kc0CVTtUkWvl",
|
|
|
"outputId": "826e6f32-267b-4eeb-d36e-3a64faae18ee"
|
|
|
},
|
|
|
- "execution_count": 2,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "execute_result",
|
|
@@ -180,7 +178,7 @@
|
|
|
"metadata": {
|
|
|
"id": "fbx71jhaMGK5"
|
|
|
},
|
|
|
- "execution_count": 3,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": []
|
|
|
},
|
|
|
{
|
|
@@ -209,7 +207,7 @@
|
|
|
"metadata": {
|
|
|
"id": "gMfzUJVOR9Lr"
|
|
|
},
|
|
|
- "execution_count": 4,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": []
|
|
|
},
|
|
|
{
|
|
@@ -232,7 +230,7 @@
|
|
|
"metadata": {
|
|
|
"id": "eRbskn48QNfW"
|
|
|
},
|
|
|
- "execution_count": 5,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": []
|
|
|
},
|
|
|
{
|
|
@@ -243,7 +241,7 @@
|
|
|
"metadata": {
|
|
|
"id": "J9VuGHGYSR5q"
|
|
|
},
|
|
|
- "execution_count": 8,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": []
|
|
|
},
|
|
|
{
|
|
@@ -258,7 +256,7 @@
|
|
|
"id": "ycfL7LvHSu2h",
|
|
|
"outputId": "b094ba01-9f1b-4d00-cd3d-52d4ceb85571"
|
|
|
},
|
|
|
- "execution_count": 9,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "stream",
|
|
@@ -281,7 +279,7 @@
|
|
|
"id": "eL7EDMq_SxlJ",
|
|
|
"outputId": "7081347c-f80d-482e-9df7-fb48123c1e59"
|
|
|
},
|
|
|
- "execution_count": 10,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "stream",
|
|
@@ -312,7 +310,7 @@
|
|
|
"id": "BbiL_o5dZZhg",
|
|
|
"outputId": "aa3d4c12-536f-4ac9-9ec6-64bfd7fa8ded"
|
|
|
},
|
|
|
- "execution_count": 11,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "stream",
|
|
@@ -358,7 +356,7 @@
|
|
|
"metadata": {
|
|
|
"id": "jKidKeUpZkPb"
|
|
|
},
|
|
|
- "execution_count": 12,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": []
|
|
|
},
|
|
|
{
|
|
@@ -371,7 +369,7 @@
|
|
|
"metadata": {
|
|
|
"id": "XHy1pVjlaLtm"
|
|
|
},
|
|
|
- "execution_count": 13,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": []
|
|
|
},
|
|
|
{
|
|
@@ -386,7 +384,7 @@
|
|
|
"id": "MTqi2hRkaXoW",
|
|
|
"outputId": "b856d3e7-7b9b-4036-8d4d-7967ff4dfadb"
|
|
|
},
|
|
|
- "execution_count": 14,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "execute_result",
|
|
@@ -424,7 +422,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 15,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/",
|
|
@@ -489,7 +487,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 6,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"id": "GwxKEVnKWWss"
|
|
|
},
|
|
@@ -519,7 +517,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 17,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/",
|
|
@@ -814,7 +812,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 18,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -849,7 +847,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 19,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"id": "1Sj65mDxNeJv"
|
|
|
},
|
|
@@ -879,7 +877,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 20,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/",
|
|
@@ -1380,7 +1378,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 21,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"id": "gIoe9TqOof-V"
|
|
|
},
|
|
@@ -1410,7 +1408,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 22,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -1454,7 +1452,7 @@
|
|
|
"id": "y7LDwR6kJdkO",
|
|
|
"outputId": "669265d1-2765-42d5-9228-83d597812e36"
|
|
|
},
|
|
|
- "execution_count": 23,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "stream",
|
|
@@ -1536,7 +1534,7 @@
|
|
|
"metadata": {
|
|
|
"id": "jJdkDvxKOq8P"
|
|
|
},
|
|
|
- "execution_count": 25,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": []
|
|
|
},
|
|
|
{
|
|
@@ -1684,7 +1682,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 7,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"id": "GIV-N87TQMFB"
|
|
|
},
|
|
@@ -1731,7 +1729,7 @@
|
|
|
"id": "XH-AyIzFf2z8",
|
|
|
"outputId": "8e613dca-dd08-40c0-c67e-a4f29ef294cc"
|
|
|
},
|
|
|
- "execution_count": 8,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "execute_result",
|
|
@@ -2044,7 +2042,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 9,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/",
|
|
@@ -2088,7 +2086,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 10,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"id": "wmTQrtkgZ_mT"
|
|
|
},
|
|
@@ -2113,7 +2111,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 12,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2145,7 +2143,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 13,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2168,7 +2166,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 14,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2193,7 +2191,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 15,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2247,7 +2245,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 16,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2279,7 +2277,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 17,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2302,7 +2300,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 18,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2327,7 +2325,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 19,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2380,7 +2378,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 20,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2412,7 +2410,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 21,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2435,7 +2433,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 22,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2460,7 +2458,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 23,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2514,7 +2512,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 24,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"id": "Y2c9_n-TPiaM"
|
|
|
},
|
|
@@ -2534,7 +2532,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 25,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2570,7 +2568,7 @@
|
|
|
"id": "RouJ1Grer9aO",
|
|
|
"outputId": "5c0b649d-6c64-4d95-a27e-56a30d5677f9"
|
|
|
},
|
|
|
- "execution_count": 26,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "stream",
|
|
@@ -2591,7 +2589,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 27,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2626,7 +2624,7 @@
|
|
|
"id": "cxBt-OJUrcot",
|
|
|
"outputId": "21bf2697-ead5-43a9-f1a3-a37731a11d32"
|
|
|
},
|
|
|
- "execution_count": 28,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "stream",
|
|
@@ -2669,7 +2667,7 @@
|
|
|
"id": "9Wc51t_ARu-5",
|
|
|
"outputId": "a32dc581-9d05-46d2-b8de-7502d84b441d"
|
|
|
},
|
|
|
- "execution_count": 30,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "stream",
|
|
@@ -2701,7 +2699,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 31,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2735,7 +2733,7 @@
|
|
|
"id": "mQhqri5pr61D",
|
|
|
"outputId": "549cd56b-a481-4139-d10c-687140999798"
|
|
|
},
|
|
|
- "execution_count": 32,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "stream",
|
|
@@ -2756,7 +2754,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 33,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2791,7 +2789,7 @@
|
|
|
"id": "XH79fdRAR2R0",
|
|
|
"outputId": "31d62932-0d7b-4cfc-a96f-8aaf115d1500"
|
|
|
},
|
|
|
- "execution_count": 34,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "stream",
|
|
@@ -2816,7 +2814,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 35,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2850,7 +2848,7 @@
|
|
|
"id": "M2KmTv8Sr2nn",
|
|
|
"outputId": "dfb6627f-3ac4-45cd-ef5f-2ed09c70623f"
|
|
|
},
|
|
|
- "execution_count": 36,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "stream",
|
|
@@ -2871,7 +2869,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 37,
|
|
|
+ "execution_count": null,
|
|
|
"metadata": {
|
|
|
"colab": {
|
|
|
"base_uri": "https://localhost:8080/"
|
|
@@ -2906,7 +2904,7 @@
|
|
|
"id": "xG1Nc_MTR5ab",
|
|
|
"outputId": "be2edb06-9c81-453a-c142-0d3ef9b41aca"
|
|
|
},
|
|
|
- "execution_count": 38,
|
|
|
+ "execution_count": null,
|
|
|
"outputs": [
|
|
|
{
|
|
|
"output_type": "stream",
|