File size: 4,065 Bytes
8d7ec14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d6bdd156-e441-4f7b-bd7e-d397fc335428",
   "metadata": {},
   "outputs": [],
   "source": [
    "!kill -9 $(ps -ef | grep 'relauncher.py' | grep -v 'grep' | awk '{print $2}')\n",
    "!kill -9 $(ps -ef | grep 'webui' | grep -v 'grep' | awk '{print $2}')\n",
    "!kill -9 $(ps -ef | grep 'launch.py' | grep -v 'grep' | awk '{print $2}')\n",
    "!kill -9 $(ps -ef | grep 'run.sh' | grep -v 'grep' | awk '{print $2}')\n",
    "!kill -9 $(ps -ef | grep 'run.py' | grep -v 'grep' | awk '{print $2}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f34d6131-8170-4173-ac5c-f835c9fa6ea5",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "%cd /workspace\n",
    "!sh /workspace/run.sh\n",
    "#final_args = f\"python /workspace/SD/launch.py --port 7860 --api --theme dark --allow-code --enable-insecure-extension-access --listen --share --cuda-malloc --cuda-stream --pin-shared-memory\"\n",
    "#!{final_args}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1778d96c-dca4-4d2a-bbe6-3ee6b29fc504",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a6dc2425-7df8-4d99-80b3-312bac52019f",
   "metadata": {},
   "outputs": [],
   "source": [
    "!git -C /workspace/SD/models fetch --all\n",
    "!git -C /workspace/SD/models reset --hard origin/main\n",
    "!git -C /workspace/SD/models pull\n",
    "!git -C /workspace/SD/models repack -a -d --depth=250 --window=250\n",
    "!rsync -r \"/workspace/SD/models/embeddings/\" \"/workspace/SD/embeddings/\"\n",
    "!rm -r \"/workspace/SD/models/.git/lfs\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6d5e74dc-c597-4182-927b-fb506987d7ca",
   "metadata": {},
   "outputs": [],
   "source": [
    "!sh /workspace/out.sh 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "abb78189-95bc-4d04-b897-b75ffa5ec539",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "if os.path.exists(\"/workspace/SD/output\"):\n",
    "    !runpodctl send /workspace/SD/output\n",
    "else:\n",
    "    if os.path.exists(\"/workspace/output\"):\n",
    "        !runpodctl send /workspace/output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9ebbbb83-c8ef-47d2-b038-92145196385e",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "645dbd2b-0f6f-4791-8b30-435649d27ed2",
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch\n",
    "import torchvision\n",
    "print(torch.__version__)\n",
    "print(torchvision.__version__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "87d3aadd-7a32-4132-a1ec-0d53b75518be",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c7f291ff-c792-454e-9a20-211759f9e208",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "94503b7f-e460-4eda-8679-058497ae771a",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "checkpointDownloadIndex = 4\n",
    "\n",
    "%cd /workspace\n",
    "!git clone https://github.com/zuv0/s\n",
    "!sh ./s/rp.sh f\"{checkpointDownloadIndex} 0 0 0\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  },
  "vscode": {
   "interpreter": {
    "hash": "c36c8ff63afb68809d72fa6323bde02fb9b90fe01b492d36c13befd021790766"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}