Download sd.py from ACCA225/InternStudio: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/datasets/ACCA225/InternStudio/resolve/main/sd.py
- Command line
-
hf download hf://datasets/ACCA225/InternStudio/sd.py
-
curl -L -o sd.py https://huggingface.co/datasets/ACCA225/InternStudio/resolve/main/sd.py
1.08 kB
| import os | |
| import subprocess | |
| import subprocess | |
| # 启动Jupyter Lab | |
| subprocess.Popen([ | |
| "jupyter-lab", | |
| "--no-browser", | |
| "--ip=0.0.0.0", | |
| "--allow-root", | |
| "--notebook-dir=/", | |
| "--port=8888", | |
| "--LabApp.allow_origin=*", | |
| "--LabApp.token=", | |
| "--LabApp.base_url=" | |
| ]) | |
| # 更新包列表并安装aria2和screen | |
| os.system("apt update && apt install -y aria2 screen") | |
| # 获取下载链接和文件保存名字 | |
| download_link = input("请输入下载链接:") | |
| file_name = input("请输入文件保存名字(带后缀的):") | |
| # 使用aria2进行下载,并将文件保存到指定目录 | |
| os.system(f"cd /group_share/lora-scripts/sd-models && aria2c -x 16 -s 16 -c '{download_link}' -o '{file_name}.safetensors'") | |
| # 激活conda环境并运行脚本 | |
| os.system("conda activate lora") | |
| os.system("cd /group_share/xlab-app-center/stable-diffusion-webui && HF_ENDPOINT=https://hf-mirror.com /root/.conda/bin/python launch.py --api --xformers --port=7860 --no-hashing --ckpt-dir=/group_share/lora-scripts/sd-models --lora-dir=/group_share/lora-scripts/output") | |