Upload lora.py
Browse files
lora.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import subprocess
|
3 |
+
import subprocess
|
4 |
+
|
5 |
+
# 启动Jupyter Lab
|
6 |
+
subprocess.Popen([
|
7 |
+
"jupyter-lab",
|
8 |
+
"--no-browser",
|
9 |
+
"--ip=0.0.0.0",
|
10 |
+
"--allow-root",
|
11 |
+
"--notebook-dir=/",
|
12 |
+
"--port=8888",
|
13 |
+
"--LabApp.allow_origin=*",
|
14 |
+
"--LabApp.token=",
|
15 |
+
"--LabApp.base_url="
|
16 |
+
])
|
17 |
+
# 更新包列表并安装aria2和screen
|
18 |
+
os.system("apt update && apt install -y aria2 screen")
|
19 |
+
|
20 |
+
# 获取下载链接和文件保存名字
|
21 |
+
download_link = input("请输入下载链接:")
|
22 |
+
file_name = input("请输入文件保存名字(带后缀的):")
|
23 |
+
|
24 |
+
# 使用aria2进行下载,并将文件保存到指定目录
|
25 |
+
os.system(f"cd /group_share/lora-scripts/sd-models && aria2c -x 16 -s 16 -c '{download_link}' -o '{file_name}.safetensors'")
|
26 |
+
|
27 |
+
# 激活conda环境并运行脚本
|
28 |
+
os.system("conda activate lora && cd /group_share/lora-scripts && HF_ENDPOINT=https://hf-mirror.com python gui.py")
|