Agon H
commited on
Commit
•
a6928d9
1
Parent(s):
c4de4ae
Upload run this model.ipynb
Browse files- run this model.ipynb +360 -0
run this model.ipynb
ADDED
@@ -0,0 +1,360 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 3,
|
6 |
+
"id": "f316df6e-3718-4db2-a856-9869af26a279",
|
7 |
+
"metadata": {
|
8 |
+
"tags": []
|
9 |
+
},
|
10 |
+
"outputs": [
|
11 |
+
{
|
12 |
+
"name": "stdout",
|
13 |
+
"output_type": "stream",
|
14 |
+
"text": [
|
15 |
+
"Collecting transformers==4.32.0\n",
|
16 |
+
" Downloading transformers-4.32.0-py3-none-any.whl (7.5 MB)\n",
|
17 |
+
"\u001b[K |████████████████████████████████| 7.5 MB 14.2 MB/s eta 0:00:01\n",
|
18 |
+
"\u001b[?25hRequirement already satisfied: safetensors>=0.3.1 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers==4.32.0) (0.3.3)\n",
|
19 |
+
"Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers==4.32.0) (0.13.3)\n",
|
20 |
+
"Requirement already satisfied: packaging>=20.0 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers==4.32.0) (23.1)\n",
|
21 |
+
"Requirement already satisfied: regex!=2019.12.17 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers==4.32.0) (2023.8.8)\n",
|
22 |
+
"Requirement already satisfied: tqdm>=4.27 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers==4.32.0) (4.66.1)\n",
|
23 |
+
"Requirement already satisfied: pyyaml>=5.1 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers==4.32.0) (6.0)\n",
|
24 |
+
"Requirement already satisfied: numpy>=1.17 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers==4.32.0) (1.25.2)\n",
|
25 |
+
"Requirement already satisfied: filelock in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers==4.32.0) (3.12.3)\n",
|
26 |
+
"Requirement already satisfied: huggingface-hub<1.0,>=0.15.1 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers==4.32.0) (0.16.4)\n",
|
27 |
+
"Requirement already satisfied: requests in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers==4.32.0) (2.31.0)\n",
|
28 |
+
"Requirement already satisfied: typing-extensions>=3.7.4.3 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from huggingface-hub<1.0,>=0.15.1->transformers==4.32.0) (4.7.1)\n",
|
29 |
+
"Requirement already satisfied: fsspec in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from huggingface-hub<1.0,>=0.15.1->transformers==4.32.0) (2023.6.0)\n",
|
30 |
+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from requests->transformers==4.32.0) (2.0.4)\n",
|
31 |
+
"Requirement already satisfied: charset-normalizer<4,>=2 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from requests->transformers==4.32.0) (3.2.0)\n",
|
32 |
+
"Requirement already satisfied: certifi>=2017.4.17 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from requests->transformers==4.32.0) (2023.7.22)\n",
|
33 |
+
"Requirement already satisfied: idna<4,>=2.5 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from requests->transformers==4.32.0) (3.4)\n",
|
34 |
+
"Installing collected packages: transformers\n",
|
35 |
+
" Attempting uninstall: transformers\n",
|
36 |
+
" Found existing installation: transformers 4.33.1\n",
|
37 |
+
" Uninstalling transformers-4.33.1:\n",
|
38 |
+
" Successfully uninstalled transformers-4.33.1\n",
|
39 |
+
"Successfully installed transformers-4.32.0\n",
|
40 |
+
"Requirement already satisfied: bitsandbytes==0.41.1 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (0.41.1)\n",
|
41 |
+
"Requirement already satisfied: peft==0.5.0 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (0.5.0)\n",
|
42 |
+
"Requirement already satisfied: accelerate in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from peft==0.5.0) (0.22.0)\n",
|
43 |
+
"Requirement already satisfied: packaging>=20.0 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from peft==0.5.0) (23.1)\n",
|
44 |
+
"Requirement already satisfied: safetensors in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from peft==0.5.0) (0.3.3)\n",
|
45 |
+
"Requirement already satisfied: transformers in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from peft==0.5.0) (4.32.0)\n",
|
46 |
+
"Requirement already satisfied: pyyaml in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from peft==0.5.0) (6.0)\n",
|
47 |
+
"Requirement already satisfied: tqdm in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from peft==0.5.0) (4.66.1)\n",
|
48 |
+
"Requirement already satisfied: psutil in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from peft==0.5.0) (5.9.5)\n",
|
49 |
+
"Requirement already satisfied: numpy>=1.17 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from peft==0.5.0) (1.25.2)\n",
|
50 |
+
"Requirement already satisfied: torch>=1.13.0 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from peft==0.5.0) (2.0.1)\n",
|
51 |
+
"Requirement already satisfied: filelock in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (3.12.3)\n",
|
52 |
+
"Requirement already satisfied: sympy in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (1.12)\n",
|
53 |
+
"Requirement already satisfied: nvidia-cusolver-cu11==11.4.0.1 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (11.4.0.1)\n",
|
54 |
+
"Requirement already satisfied: jinja2 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (3.1.2)\n",
|
55 |
+
"Requirement already satisfied: nvidia-cuda-cupti-cu11==11.7.101 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (11.7.101)\n",
|
56 |
+
"Requirement already satisfied: nvidia-nvtx-cu11==11.7.91 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (11.7.91)\n",
|
57 |
+
"Requirement already satisfied: nvidia-cufft-cu11==10.9.0.58 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (10.9.0.58)\n",
|
58 |
+
"Requirement already satisfied: nvidia-nccl-cu11==2.14.3 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (2.14.3)\n",
|
59 |
+
"Requirement already satisfied: nvidia-curand-cu11==10.2.10.91 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (10.2.10.91)\n",
|
60 |
+
"Requirement already satisfied: networkx in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (3.1)\n",
|
61 |
+
"Requirement already satisfied: typing-extensions in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (4.7.1)\n",
|
62 |
+
"Requirement already satisfied: nvidia-cuda-nvrtc-cu11==11.7.99 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (11.7.99)\n",
|
63 |
+
"Requirement already satisfied: nvidia-cublas-cu11==11.10.3.66 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (11.10.3.66)\n",
|
64 |
+
"Requirement already satisfied: nvidia-cudnn-cu11==8.5.0.96 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (8.5.0.96)\n",
|
65 |
+
"Requirement already satisfied: nvidia-cusparse-cu11==11.7.4.91 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (11.7.4.91)\n",
|
66 |
+
"Requirement already satisfied: triton==2.0.0 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (2.0.0)\n",
|
67 |
+
"Requirement already satisfied: nvidia-cuda-runtime-cu11==11.7.99 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.13.0->peft==0.5.0) (11.7.99)\n",
|
68 |
+
"Requirement already satisfied: setuptools in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=1.13.0->peft==0.5.0) (68.0.0)\n",
|
69 |
+
"Requirement already satisfied: wheel in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=1.13.0->peft==0.5.0) (0.41.1)\n",
|
70 |
+
"Requirement already satisfied: lit in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from triton==2.0.0->torch>=1.13.0->peft==0.5.0) (16.0.6)\n",
|
71 |
+
"Requirement already satisfied: cmake in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from triton==2.0.0->torch>=1.13.0->peft==0.5.0) (3.27.2)\n",
|
72 |
+
"Requirement already satisfied: MarkupSafe>=2.0 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from jinja2->torch>=1.13.0->peft==0.5.0) (2.1.3)\n",
|
73 |
+
"Requirement already satisfied: mpmath>=0.19 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from sympy->torch>=1.13.0->peft==0.5.0) (1.3.0)\n",
|
74 |
+
"Requirement already satisfied: huggingface-hub<1.0,>=0.15.1 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers->peft==0.5.0) (0.16.4)\n",
|
75 |
+
"Requirement already satisfied: requests in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers->peft==0.5.0) (2.31.0)\n",
|
76 |
+
"Requirement already satisfied: regex!=2019.12.17 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers->peft==0.5.0) (2023.8.8)\n",
|
77 |
+
"Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from transformers->peft==0.5.0) (0.13.3)\n",
|
78 |
+
"Requirement already satisfied: fsspec in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from huggingface-hub<1.0,>=0.15.1->transformers->peft==0.5.0) (2023.6.0)\n",
|
79 |
+
"Requirement already satisfied: charset-normalizer<4,>=2 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from requests->transformers->peft==0.5.0) (3.2.0)\n",
|
80 |
+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from requests->transformers->peft==0.5.0) (2.0.4)\n",
|
81 |
+
"Requirement already satisfied: certifi>=2017.4.17 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from requests->transformers->peft==0.5.0) (2023.7.22)\n",
|
82 |
+
"Requirement already satisfied: idna<4,>=2.5 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from requests->transformers->peft==0.5.0) (3.4)\n",
|
83 |
+
"Requirement already satisfied: accelerate==0.22.0 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (0.22.0)\n",
|
84 |
+
"Requirement already satisfied: packaging>=20.0 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from accelerate==0.22.0) (23.1)\n",
|
85 |
+
"Requirement already satisfied: torch>=1.10.0 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from accelerate==0.22.0) (2.0.1)\n",
|
86 |
+
"Requirement already satisfied: psutil in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from accelerate==0.22.0) (5.9.5)\n",
|
87 |
+
"Requirement already satisfied: pyyaml in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from accelerate==0.22.0) (6.0)\n",
|
88 |
+
"Requirement already satisfied: numpy>=1.17 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from accelerate==0.22.0) (1.25.2)\n",
|
89 |
+
"Requirement already satisfied: nvidia-cudnn-cu11==8.5.0.96 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (8.5.0.96)\n",
|
90 |
+
"Requirement already satisfied: nvidia-nccl-cu11==2.14.3 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (2.14.3)\n",
|
91 |
+
"Requirement already satisfied: typing-extensions in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (4.7.1)\n",
|
92 |
+
"Requirement already satisfied: nvidia-cublas-cu11==11.10.3.66 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (11.10.3.66)\n",
|
93 |
+
"Requirement already satisfied: triton==2.0.0 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (2.0.0)\n",
|
94 |
+
"Requirement already satisfied: sympy in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (1.12)\n",
|
95 |
+
"Requirement already satisfied: filelock in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (3.12.3)\n",
|
96 |
+
"Requirement already satisfied: nvidia-cusolver-cu11==11.4.0.1 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (11.4.0.1)\n",
|
97 |
+
"Requirement already satisfied: networkx in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (3.1)\n",
|
98 |
+
"Requirement already satisfied: nvidia-cufft-cu11==10.9.0.58 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (10.9.0.58)\n",
|
99 |
+
"Requirement already satisfied: nvidia-cuda-cupti-cu11==11.7.101 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (11.7.101)\n",
|
100 |
+
"Requirement already satisfied: jinja2 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (3.1.2)\n",
|
101 |
+
"Requirement already satisfied: nvidia-cuda-runtime-cu11==11.7.99 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (11.7.99)\n",
|
102 |
+
"Requirement already satisfied: nvidia-cuda-nvrtc-cu11==11.7.99 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (11.7.99)\n",
|
103 |
+
"Requirement already satisfied: nvidia-curand-cu11==10.2.10.91 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (10.2.10.91)\n",
|
104 |
+
"Requirement already satisfied: nvidia-nvtx-cu11==11.7.91 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (11.7.91)\n",
|
105 |
+
"Requirement already satisfied: nvidia-cusparse-cu11==11.7.4.91 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from torch>=1.10.0->accelerate==0.22.0) (11.7.4.91)\n",
|
106 |
+
"Requirement already satisfied: setuptools in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=1.10.0->accelerate==0.22.0) (68.0.0)\n",
|
107 |
+
"Requirement already satisfied: wheel in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=1.10.0->accelerate==0.22.0) (0.41.1)\n",
|
108 |
+
"Requirement already satisfied: cmake in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from triton==2.0.0->torch>=1.10.0->accelerate==0.22.0) (3.27.2)\n",
|
109 |
+
"Requirement already satisfied: lit in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from triton==2.0.0->torch>=1.10.0->accelerate==0.22.0) (16.0.6)\n",
|
110 |
+
"Requirement already satisfied: MarkupSafe>=2.0 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from jinja2->torch>=1.10.0->accelerate==0.22.0) (2.1.3)\n",
|
111 |
+
"Requirement already satisfied: mpmath>=0.19 in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (from sympy->torch>=1.10.0->accelerate==0.22.0) (1.3.0)\n",
|
112 |
+
"Requirement already satisfied: sentencepiece in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (0.1.99)\n",
|
113 |
+
"Requirement already satisfied: protobuf in /home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages (4.24.2)\n"
|
114 |
+
]
|
115 |
+
}
|
116 |
+
],
|
117 |
+
"source": [
|
118 |
+
"!pip install transformers==4.32.0\n",
|
119 |
+
"!pip install bitsandbytes==0.41.1\n",
|
120 |
+
"!pip install peft==0.5.0\n",
|
121 |
+
"!pip install accelerate==0.22.0\n",
|
122 |
+
"!pip install sentencepiece protobuf"
|
123 |
+
]
|
124 |
+
},
|
125 |
+
{
|
126 |
+
"cell_type": "code",
|
127 |
+
"execution_count": 4,
|
128 |
+
"id": "ae620da8-b431-4313-ad3a-3847f434370e",
|
129 |
+
"metadata": {
|
130 |
+
"tags": []
|
131 |
+
},
|
132 |
+
"outputs": [
|
133 |
+
{
|
134 |
+
"data": {
|
135 |
+
"application/vnd.jupyter.widget-view+json": {
|
136 |
+
"model_id": "83205f0aaad3424c847fa568ceab8c84",
|
137 |
+
"version_major": 2,
|
138 |
+
"version_minor": 0
|
139 |
+
},
|
140 |
+
"text/plain": [
|
141 |
+
"Downloading (…)okenizer_config.json: 0%| | 0.00/237 [00:00<?, ?B/s]"
|
142 |
+
]
|
143 |
+
},
|
144 |
+
"metadata": {},
|
145 |
+
"output_type": "display_data"
|
146 |
+
},
|
147 |
+
{
|
148 |
+
"data": {
|
149 |
+
"application/vnd.jupyter.widget-view+json": {
|
150 |
+
"model_id": "ba0120b4f01b479fb3977fa16b8dae5f",
|
151 |
+
"version_major": 2,
|
152 |
+
"version_minor": 0
|
153 |
+
},
|
154 |
+
"text/plain": [
|
155 |
+
"Downloading (…)/main/tokenizer.json: 0%| | 0.00/2.11M [00:00<?, ?B/s]"
|
156 |
+
]
|
157 |
+
},
|
158 |
+
"metadata": {},
|
159 |
+
"output_type": "display_data"
|
160 |
+
},
|
161 |
+
{
|
162 |
+
"data": {
|
163 |
+
"application/vnd.jupyter.widget-view+json": {
|
164 |
+
"model_id": "66d0cf96881a4506b58d9963da764cb5",
|
165 |
+
"version_major": 2,
|
166 |
+
"version_minor": 0
|
167 |
+
},
|
168 |
+
"text/plain": [
|
169 |
+
"Downloading (…)cial_tokens_map.json: 0%| | 0.00/99.0 [00:00<?, ?B/s]"
|
170 |
+
]
|
171 |
+
},
|
172 |
+
"metadata": {},
|
173 |
+
"output_type": "display_data"
|
174 |
+
},
|
175 |
+
{
|
176 |
+
"data": {
|
177 |
+
"application/vnd.jupyter.widget-view+json": {
|
178 |
+
"model_id": "a0dee4d0643041598db861d1aa252b8b",
|
179 |
+
"version_major": 2,
|
180 |
+
"version_minor": 0
|
181 |
+
},
|
182 |
+
"text/plain": [
|
183 |
+
"Downloading (…)lve/main/config.json: 0%| | 0.00/1.12k [00:00<?, ?B/s]"
|
184 |
+
]
|
185 |
+
},
|
186 |
+
"metadata": {},
|
187 |
+
"output_type": "display_data"
|
188 |
+
},
|
189 |
+
{
|
190 |
+
"data": {
|
191 |
+
"application/vnd.jupyter.widget-view+json": {
|
192 |
+
"model_id": "978281e21e5f45d0ae661e6b59df82f7",
|
193 |
+
"version_major": 2,
|
194 |
+
"version_minor": 0
|
195 |
+
},
|
196 |
+
"text/plain": [
|
197 |
+
"Downloading (…)model.bin.index.json: 0%| | 0.00/16.1k [00:00<?, ?B/s]"
|
198 |
+
]
|
199 |
+
},
|
200 |
+
"metadata": {},
|
201 |
+
"output_type": "display_data"
|
202 |
+
},
|
203 |
+
{
|
204 |
+
"data": {
|
205 |
+
"application/vnd.jupyter.widget-view+json": {
|
206 |
+
"model_id": "47b5193204f2468f8eccfd10a74874ea",
|
207 |
+
"version_major": 2,
|
208 |
+
"version_minor": 0
|
209 |
+
},
|
210 |
+
"text/plain": [
|
211 |
+
"Downloading shards: 0%| | 0/2 [00:00<?, ?it/s]"
|
212 |
+
]
|
213 |
+
},
|
214 |
+
"metadata": {},
|
215 |
+
"output_type": "display_data"
|
216 |
+
},
|
217 |
+
{
|
218 |
+
"data": {
|
219 |
+
"application/vnd.jupyter.widget-view+json": {
|
220 |
+
"model_id": "93e201749fc843cfb5ed866e802c3843",
|
221 |
+
"version_major": 2,
|
222 |
+
"version_minor": 0
|
223 |
+
},
|
224 |
+
"text/plain": [
|
225 |
+
"Downloading (…)l-00001-of-00002.bin: 0%| | 0.00/9.94G [00:00<?, ?B/s]"
|
226 |
+
]
|
227 |
+
},
|
228 |
+
"metadata": {},
|
229 |
+
"output_type": "display_data"
|
230 |
+
},
|
231 |
+
{
|
232 |
+
"data": {
|
233 |
+
"application/vnd.jupyter.widget-view+json": {
|
234 |
+
"model_id": "c1fb62bbfca74af3ab77bc69e96238e6",
|
235 |
+
"version_major": 2,
|
236 |
+
"version_minor": 0
|
237 |
+
},
|
238 |
+
"text/plain": [
|
239 |
+
"Downloading (…)l-00002-of-00002.bin: 0%| | 0.00/3.36G [00:00<?, ?B/s]"
|
240 |
+
]
|
241 |
+
},
|
242 |
+
"metadata": {},
|
243 |
+
"output_type": "display_data"
|
244 |
+
},
|
245 |
+
{
|
246 |
+
"data": {
|
247 |
+
"application/vnd.jupyter.widget-view+json": {
|
248 |
+
"model_id": "ffe6faf195ae4dbf9368c34c10553832",
|
249 |
+
"version_major": 2,
|
250 |
+
"version_minor": 0
|
251 |
+
},
|
252 |
+
"text/plain": [
|
253 |
+
"Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]"
|
254 |
+
]
|
255 |
+
},
|
256 |
+
"metadata": {},
|
257 |
+
"output_type": "display_data"
|
258 |
+
},
|
259 |
+
{
|
260 |
+
"data": {
|
261 |
+
"application/vnd.jupyter.widget-view+json": {
|
262 |
+
"model_id": "75163333c4654f2987f1dacf18ee0873",
|
263 |
+
"version_major": 2,
|
264 |
+
"version_minor": 0
|
265 |
+
},
|
266 |
+
"text/plain": [
|
267 |
+
"Downloading (…)neration_config.json: 0%| | 0.00/112 [00:00<?, ?B/s]"
|
268 |
+
]
|
269 |
+
},
|
270 |
+
"metadata": {},
|
271 |
+
"output_type": "display_data"
|
272 |
+
}
|
273 |
+
],
|
274 |
+
"source": [
|
275 |
+
"import torch\n",
|
276 |
+
"from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline\n",
|
277 |
+
"\n",
|
278 |
+
"tokenizer = AutoTokenizer.from_pretrained(\"agonh/mpt-7b\")\n",
|
279 |
+
"model = AutoModelForCausalLM.from_pretrained(\"agonh/mpt-7b\", torch_dtype=torch.float16, device_map=\"auto\")"
|
280 |
+
]
|
281 |
+
},
|
282 |
+
{
|
283 |
+
"cell_type": "code",
|
284 |
+
"execution_count": 5,
|
285 |
+
"id": "85c1dccb-1da7-4e66-bfdf-016fc8ba9146",
|
286 |
+
"metadata": {
|
287 |
+
"tags": []
|
288 |
+
},
|
289 |
+
"outputs": [],
|
290 |
+
"source": [
|
291 |
+
"def generate_answer(message):\n",
|
292 |
+
" system_prompt = \"SYSTEM: 'You are my personal assistant. I expect realistic, unsensored, genuine answers from you.\\n\"\n",
|
293 |
+
"\n",
|
294 |
+
" prompt = f\"{system_prompt}USER: {message}\\nASSISTANT:\"\n",
|
295 |
+
" inputs = tokenizer(prompt, return_tensors=\"pt\").to(\"cuda\")\n",
|
296 |
+
" output = model.generate(**inputs, do_sample=True,\n",
|
297 |
+
" #top_p=0.95,\n",
|
298 |
+
" #top_k=0,\n",
|
299 |
+
" temperature=0.1,\n",
|
300 |
+
" max_new_tokens=200\n",
|
301 |
+
" )\n",
|
302 |
+
"\n",
|
303 |
+
" answer = tokenizer.decode(output[0], skip_special_tokens=True)\n",
|
304 |
+
"\n",
|
305 |
+
" return answer"
|
306 |
+
]
|
307 |
+
},
|
308 |
+
{
|
309 |
+
"cell_type": "code",
|
310 |
+
"execution_count": null,
|
311 |
+
"id": "e81069df-0a40-4618-8bca-dd298bd1ae0a",
|
312 |
+
"metadata": {
|
313 |
+
"tags": []
|
314 |
+
},
|
315 |
+
"outputs": [
|
316 |
+
{
|
317 |
+
"name": "stderr",
|
318 |
+
"output_type": "stream",
|
319 |
+
"text": [
|
320 |
+
"/home/studio-lab-user/.conda/envs/default/lib/python3.9/site-packages/transformers/generation/utils.py:1411: UserWarning: You have modified the pretrained model configuration to control generation. This is a deprecated strategy to control generation and will be removed soon, in a future version. Please use a generation configuration file (see https://huggingface.co/docs/transformers/main_classes/text_generation )\n",
|
321 |
+
" warnings.warn(\n"
|
322 |
+
]
|
323 |
+
}
|
324 |
+
],
|
325 |
+
"source": [
|
326 |
+
"prompt = \"Tell me about ghost.\"\n",
|
327 |
+
"print(generate_answer(prompt))"
|
328 |
+
]
|
329 |
+
},
|
330 |
+
{
|
331 |
+
"cell_type": "code",
|
332 |
+
"execution_count": null,
|
333 |
+
"id": "1b834ffc-4407-4d47-84f4-39fcbdd61ba8",
|
334 |
+
"metadata": {},
|
335 |
+
"outputs": [],
|
336 |
+
"source": []
|
337 |
+
}
|
338 |
+
],
|
339 |
+
"metadata": {
|
340 |
+
"kernelspec": {
|
341 |
+
"display_name": "default:Python",
|
342 |
+
"language": "python",
|
343 |
+
"name": "conda-env-default-py"
|
344 |
+
},
|
345 |
+
"language_info": {
|
346 |
+
"codemirror_mode": {
|
347 |
+
"name": "ipython",
|
348 |
+
"version": 3
|
349 |
+
},
|
350 |
+
"file_extension": ".py",
|
351 |
+
"mimetype": "text/x-python",
|
352 |
+
"name": "python",
|
353 |
+
"nbconvert_exporter": "python",
|
354 |
+
"pygments_lexer": "ipython3",
|
355 |
+
"version": "3.9.16"
|
356 |
+
}
|
357 |
+
},
|
358 |
+
"nbformat": 4,
|
359 |
+
"nbformat_minor": 5
|
360 |
+
}
|