{"id":15110149,"url":"https://github.com/akegarasu/lora-scripts","last_synced_at":"2025-05-13T17:10:57.866Z","repository":{"id":65475375,"uuid":"591961298","full_name":"Akegarasu/lora-scripts","owner":"Akegarasu","description":"SD-Trainer. LoRA \u0026 Dreambooth training scripts \u0026 GUI use kohya-ss's trainer, for diffusion model.","archived":false,"fork":false,"pushed_at":"2025-03-24T08:01:20.000Z","size":2149,"stargazers_count":5174,"open_issues_count":74,"forks_count":621,"subscribers_count":33,"default_branch":"main","last_synced_at":"2025-04-09T19:05:16.965Z","etag":null,"topics":["dreambooth","finetune","lora","stable-diffusion"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Akegarasu.png","metadata":{"files":{"readme":"README-zh.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-22T13:50:45.000Z","updated_at":"2025-04-09T05:50:10.000Z","dependencies_parsed_at":"2023-10-10T15:15:14.189Z","dependency_job_id":"275ff961-89f8-4e24-9537-5600871b997a","html_url":"https://github.com/Akegarasu/lora-scripts","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akegarasu%2Flora-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akegarasu%2Flora-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akegarasu%2Flora-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akegarasu%2Flora-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Akegarasu","download_url":"https://codeload.github.com/Akegarasu/lora-scripts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250530098,"owners_count":21445724,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dreambooth","finetune","lora","stable-diffusion"],"created_at":"2024-09-25T23:41:55.886Z","updated_at":"2025-04-23T23:23:34.310Z","avatar_url":"https://github.com/Akegarasu.png","language":"Python","readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"https://github.com/Akegarasu/lora-scripts/assets/36563862/3b177f4a-d92a-4da4-85c8-a0d163061a40\" width=\"200\" height=\"200\" alt=\"SD-Trainer\" style=\"border-radius: 25px\"\u003e\n\n# SD-Trainer\n\n_✨ 享受 Stable Diffusion 训练！ ✨_\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/Akegarasu/lora-scripts\" style=\"margin: 2px;\"\u003e\n    \u003cimg alt=\"GitHub 仓库星标\" src=\"https://img.shields.io/github/stars/Akegarasu/lora-scripts\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/Akegarasu/lora-scripts\" style=\"margin: 2px;\"\u003e\n    \u003cimg alt=\"GitHub 仓库分支\" src=\"https://img.shields.io/github/forks/Akegarasu/lora-scripts\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://raw.githubusercontent.com/Akegarasu/lora-scripts/master/LICENSE\" style=\"margin: 2px;\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/Akegarasu/lora-scripts\" alt=\"许可证\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/Akegarasu/lora-scripts/releases\" style=\"margin: 2px;\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/Akegarasu/lora-scripts?color=blueviolet\u0026include_prereleases\" alt=\"发布版本\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/Akegarasu/lora-scripts/releases\"\u003e下载\u003c/a\u003e\n  ·\n  \u003ca href=\"https://github.com/Akegarasu/lora-scripts/blob/main/README.md\"\u003e文档\u003c/a\u003e\n  ·\n  \u003ca href=\"https://github.com/Akegarasu/lora-scripts/blob/main/README-zh.md\"\u003e中文README\u003c/a\u003e\n\u003c/p\u003e\n\nLoRA-scripts（又名 SD-Trainer）\n\nLoRA \u0026 Dreambooth 训练图形界面 \u0026 脚本预设 \u0026 一键训练环境，用于 [kohya-ss/sd-scripts](https://github.com/kohya-ss/sd-scripts.git)\n\n## ✨新特性: 训练 WebUI\n\nStable Diffusion 训练工作台。一切集成于一个 WebUI 中。\n\n按照下面的安装指南安装 GUI，然后运行 `run_gui.ps1`(Windows) 或 `run_gui.sh`(Linux) 来启动 GUI。\n\n![image](https://github.com/Akegarasu/lora-scripts/assets/36563862/d3fcf5ad-fb8f-4e1d-81f9-c903376c19c6)\n\n| Tensorboard | WD 1.4 标签器 | 标签编辑器 |\n| ------------ | ------------ | ------------ |\n| ![image](https://github.com/Akegarasu/lora-scripts/assets/36563862/b2ac5c36-3edf-43a6-9719-cb00b757fc76) | ![image](https://github.com/Akegarasu/lora-scripts/assets/36563862/9504fad1-7d77-46a7-a68f-91fbbdbc7407) | ![image](https://github.com/Akegarasu/lora-scripts/assets/36563862/4597917b-caa8-4e90-b950-8b01738996f2) |\n\n\n# 使用方法\n\n### 必要依赖\n\nPython 3.10 和 Git\n\n### 克隆带子模块的仓库\n\n```sh\ngit clone --recurse-submodules https://github.com/Akegarasu/lora-scripts\n```\n\n## ✨ SD-Trainer GUI\n\n### Windows\n\n#### 安装\n\n运行 `install-cn.ps1` 将自动为您创建虚拟环境并安装必要的依赖。 \n\n#### 训练\n\n运行 `run_gui.ps1`，程序将自动打开 [http://127.0.0.1:28000](http://127.0.0.1:28000)\n\n### Linux\n\n#### 安装\n\n运行 `install.bash` 将创建虚拟环境并安装必要的依赖。\n\n#### 训练\n\n运行 `bash run_gui.sh`，程序将自动打开 [http://127.0.0.1:28000](http://127.0.0.1:28000)\n\n### Docker\n\n#### 编译镜像\n\n```bash\n# 国内镜像优化版本\n# 其中 akegarasu_lora-scripts:latest 为镜像及其 tag 名，根据镜像托管服务商实际进行修改\ndocker build -t akegarasu_lora-scripts:latest -f Dockfile-for-Mainland-China .\ndocker push akegarasu_lora-scripts:latest\n```\n\n#### 使用镜像\n\n\u003e 提供一个本人已打包好并推送到 `aliyuncs` 上的镜像，此镜像压缩归档大小约 `10G` 左右，请耐心等待拉取。\n\n```bash\ndocker run --gpus all -p 28000:28000 -p 6006:6006 registry.cn-hangzhou.aliyuncs.com/go-to-mirror/akegarasu_lora-scripts:latest \n```\n\n或者使用 `docker-compose.yaml` 。\n\n```yaml\nservices:\n  lora-scripts:\n    container_name: lora-scripts\n    build:\n      context: .\n      dockerfile: Dockerfile-for-Mainland-China\n    image: \"registry.cn-hangzhou.aliyuncs.com/go-to-mirror/akegarasu_lora-scripts:latest\"\n    ports:\n      - \"28000:28000\"\n      - \"6006:6006\"  \n    # 共享本地文件夹（请根据实际修改）\n    #volumes:\n      # - \"/data/srv/lora-scripts:/app/lora-scripts\"\n      # 共享 comfyui 大模型\n      # - \"/data/srv/comfyui/models/checkpoints:/app/lora-scripts/sd-models/comfyui\"\n      # 共享 sd-webui 大模型\n      # - \"/data/srv/stable-diffusion-webui/models/Stable-diffusion:/app/lora-scripts/sd-models/sd-webui\"\n    environment:\n      - HF_HOME=huggingface\n      - PYTHONUTF8=1\n    security_opt:\n      - \"label=type:nvidia_container_t\"\n    runtime: nvidia\n    deploy:\n      resources:\n        reservations:\n          devices:\n            - driver: nvidia\n              device_ids: ['0']\n              capabilities: [gpu]\n```\n \n关于容器使用 GPU 相关依赖安装问题，请自行搜索查阅资料解决。\n\n## 通过手动运行脚本的传统训练方式\n\n### Windows\n\n#### 安装\n\n运行 `install.ps1` 将自动为您创建虚拟环境并安装必要的依赖。\n\n#### 训练\n\n编辑 `train.ps1`，然后运行它。\n\n### Linux\n\n#### 安装\n\n运行 `install.bash` 将创建虚拟环境并安装必要的依赖。\n\n#### 训练\n\n训练\n\n脚本 `train.sh` **不会** 为您激活虚拟环境。您应该先激活虚拟环境。\n\n```sh\nsource venv/bin/activate\n```\n\n编辑 `train.sh`，然后运行它。\n\n#### TensorBoard\n\n运行 `tensorboard.ps1` 将在 http://localhost:6006/ 启动 TensorBoard\n\n## 程序参数\n\n| 参数名称                     | 类型  | 默认值       | 描述                                            |\n|------------------------------|-------|--------------|-------------------------------------------------|\n| `--host`                     | str   | \"127.0.0.1\"  | 服务器的主机名                                  |\n| `--port`                     | int   | 28000        | 运行服务器的端口                                |\n| `--listen`                   | bool  | false        | 启用服务器的监听模式                            |\n| `--skip-prepare-environment` | bool  | false        | 跳过环境准备步骤                                |\n| `--disable-tensorboard`      | bool  | false        | 禁用 TensorBoard                                |\n| `--disable-tageditor`        | bool  | false        | 禁用标签编辑器                                  |\n| `--tensorboard-host`         | str   | \"127.0.0.1\"  | 运行 TensorBoard 的主机                         |\n| `--tensorboard-port`         | int   | 6006         | 运行 TensorBoard 的端口                          |\n| `--localization`             | str   |              | 界面的本地化设置                                |\n| `--dev`                      | bool  | false        | 开发者模式，用于禁用某些检查                     |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakegarasu%2Flora-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakegarasu%2Flora-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakegarasu%2Flora-scripts/lists"}