{"id":23529422,"url":"https://github.com/s9roll7/sd_batch_runner","last_synced_at":"2025-10-31T19:30:37.907Z","repository":{"id":269281035,"uuid":"865897450","full_name":"s9roll7/sd_batch_runner","owner":"s9roll7","description":"This is an application for batch execution of AUTOMATIC1111 UI launched on a local PC via api.   (This is NOT sdwebui extension.)","archived":false,"fork":false,"pushed_at":"2024-12-22T11:35:28.000Z","size":248,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-22T12:26:46.529Z","etag":null,"topics":["automatic1111","stable-diffusion","stable-diffusion-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/s9roll7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-10-01T10:11:32.000Z","updated_at":"2024-12-22T11:35:32.000Z","dependencies_parsed_at":"2024-12-22T12:38:31.215Z","dependency_job_id":null,"html_url":"https://github.com/s9roll7/sd_batch_runner","commit_stats":null,"previous_names":["s9roll7/sd_batch_runner"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s9roll7%2Fsd_batch_runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s9roll7%2Fsd_batch_runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s9roll7%2Fsd_batch_runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s9roll7%2Fsd_batch_runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s9roll7","download_url":"https://codeload.github.com/s9roll7/sd_batch_runner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239226457,"owners_count":19603270,"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":["automatic1111","stable-diffusion","stable-diffusion-api"],"created_at":"2024-12-25T21:10:27.578Z","updated_at":"2025-02-17T03:21:42.585Z","avatar_url":"https://github.com/s9roll7.png","language":"Python","readme":"# SD Batch Runner\n\nThis is an application for batch execution of [Stable Diffusion Web UI(A1111)](https://github.com/AUTOMATIC1111/stable-diffusion-webui) launched on a local PC via api.  \n(This is NOT sdwebui extension.)\n\nIt is easy to do the following.\n- Image generation by simply selecting lora without manually setting trigger word or lbw  \n- Batch generation of images with only the character or style changed with specific settings  \n- Easy to try multiple lora combinations. (ex. Generate a combination of a specific style and all character loras)  \n- Complex image generation procedures, such as those involving controlnets or consecutive txt2img,img2img, can be saved and reused at a later date.  \n  (ex. After generating txt2img once, use it as an input image and execute img2img 3 times with slightly different conditions, and execute this procedure 20 times, changing the character and style each time. )  \n\n\u003cimg src=\"img/gui_sample.png\" width=\"1024\"\u003e\n\n\n## Installation(for windows)\n[Python 3.10](https://www.python.org/) and git client must be installed  \n\n```sh\ngit clone https://github.com/s9roll7/sd_batch_runner.git\ncd sd_batch_runner\npy -3.10 -m venv venv\nvenv\\Scripts\\activate.bat\n# Please install torch according to your environment.(https://pytorch.org/get-started/locally/)\npython -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121\npip install -r requirements.txt\n```\n\n## Preparation on the sdwebui side\n### Installation\n\nThis is a client application using the sdwebui api, so it is necessary to launch sdwebui beforehand.\n- [sdwebui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) (tested with v1.10.1)  \nBy default sdwebui does not have api enabled!!! Please start with api enabled.\nhttps://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/API\n```sh\nFirst, of course, is to run webui with --api commandline argument\nexample in your \"webui-user.bat\": set COMMANDLINE_ARGS=--api\n```\n\nInstall the following extensions.\n- Stable-Diffusion-Webui-Civitai-Helper(https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper)\n\n- adetailer(https://github.com/Bing-su/adetailer)\n\n- sd-webui-controlnet(https://github.com/Mikubill/sd-webui-controlnet)  \nIt is necessary to download the controlnet model corresponding to the model you want to use.\n\n- sd-webui-lora-block-weight(https://github.com/hako-mikan/sd-webui-lora-block-weight)  \nYou must set the preset. Below is an example of a preset when using pony/sdxl\n\n```sh\nFace-1:1,0,0,0,0,0,1,1,1,0,0,0\nFace-2:1,0,1,0,1,0,0.8,1,1,0.6,0,1\nFace-3:1,0,0,0,1,0.3,1,1,1,0.8,0,0.4\nNoface:1,1,1,1,0,1,0,0,0,1,1,1\nWear:1,1,1,0,0,0,1,1,1,0,0,0\nPose:1,0,0,0,0,1,1,1,0,0,0,0\nArtStyle:1,0,0,0,0,0,0,0,0,1,1,1\nChar:1,1,1,0,0,0,1,1,1,1,1,1\nBG:1,1,1,1,0,1,0,0,0,1,1,1\nSoft:1,0,0,0,0,0,1,1,1,1,1,1\n```\n\n  \nThe following extensions are low priority.  \n  \n\n- sd-webui-segment-anything(https://github.com/continue-revolution/sd-webui-segment-anything)  \nYou need to download one of the sam models and one of the DINO models.  \nPlease note that this extension has its own installation procedure. You need to set the option to use local GroundingDINO in the options settings.\n```sh\nDue to the overwhelming complaints about GroundingDINO installation and the lack of substitution of similar high-performance text-to-bounding-box library, \nI decide to modify the source code of GroundingDINO and push to this repository. \nStarting from v1.5.0, you can choose to use local GroundingDINO by checking Use local groundingdino to bypass C++ problem on Settings/Segment Anything. \nThis change should solve all problems about ninja, pycocotools, _C and any other problems related to C++/CUDA compilation.\n```\n\n- stable-diffusion-webui-promptgen(https://github.com/davidmartinrius/stable-diffusion-webui-promptgen/tree/api-implementation)  \nPlease note that you need to install the branch that contains the api support(api-implementation branch), not the original created by AUTOMATIC1111.  \nhttps://github.com/mix1009/sdwebuiapi?tab=readme-ov-file#prompt-generator-api-by-david-martin-rius  \n\n\n### Organizing Lora Files\nThis application assumes that lora files are organized in subfolders by type.  \nThe following is an example. Some files may be difficult to classify, but there is no need to be so strict.  \n(If there are too many files to organize, you can put only the files you want to use in a subfolder.)  \n\n```sh\nYOUR_SD_PATH/models/Lora/Pony/character\nYOUR_SD_PATH/models/Lora/Pony/style\nYOUR_SD_PATH/models/Lora/Pony/pose\nYOUR_SD_PATH/models/Lora/Pony/item\nYOUR_SD_PATH/models/Lora/Pony/etc\nYOUR_SD_PATH/models/Lora/SDXL/character\nYOUR_SD_PATH/models/Lora/SDXL/style\nYOUR_SD_PATH/models/Lora/SDXL/pose\nYOUR_SD_PATH/models/Lora/SDXL/item\nYOUR_SD_PATH/models/Lora/SDXL/etc\n```\nRestart sdwebui when you have finished organizing the files.  \nThen, use the Stable-Diffusion-Webui-Civitai-Helper you just installed to collect the lora preview image and trigger word and other information.  \n(Civitai Helper Tab -\u003e \"Scan Models for Civitai\" -\u003e press \"Scan\" button)  \n\n\n## How To Use\n\nrun sdwebui\n\n\n- GUI  \nrun launch_GUI.bat  \n(Perform [Initial Setting](#initial-settings) when starting up for the first time.)  \nGo [Generate -\u003e Create New Sequence -\u003e common -\u003e prompt]  \nSelect some lora files. By default, one character lora is selected at random.  \nGo [Generate -\u003e Create New Sequence -\u003e common -\u003e prompt -\u003e preset_tags]  \nSelect quality tag.  \nGo [Generate -\u003e Create New Sequence -\u003e common -\u003e prompt -\u003e header(or footer)]  \nEnter prompt.  \nGo [bottom left of app screen -\u003e batch_count]  \nFor now, set about 4.  \nGo [bottom left of app screen -\u003e Generate]  \n\n\u003cimg src=\"img/generate.png\" width=\"512\"\u003e\n\n\n- CUI  \nrun launch_cmd.bat  \n\n```sh\npython main.py\n```\n\n### Works with [Speech Bubble Remove and Copy Tool](https://github.com/s9roll7/speech_bubble_remove_and_copy)\nGenerate clean images with the tool.  \nCreate a directory containing only the images you want to use.  \nGenerate tags from images.  \nRemove unwanted tags.  \nSelect txt2img or img2img.  \n(Optional) Set controlnet parameters.  \nPress Convert.  \nLoad the generated json file.  \nConfigure lora and prompt settings and run generation.  \nCopy the generated image to \"YOUR_PROJECT_DIR/base\"  \n\u003cimg src=\"img/tagging.png\" width=\"512\"\u003e\n\n\n\n\n## Initial Settings\nThere are a few items to be set up at first startup.  \n- Lora Directory Setting  \nSet the path of the directory containing lora. Multiple environments can be set up, but only one is needed at first.  \n- Config -\u003e main  \nSelect a stable diffusion checkpoint file.  \nSelect the environment name set in [Lora Directory Setting].  \n- Generate -\u003e Lora Update  \nRun every time you add or remove a lora file.  \n\n\n## Advanced Settings\n- Controlnet Alias Setting  \nSeveral settings are included as samples. Set the model if you want to use them.  \n- Config -\u003e lora_generate_tag  \nFeature to automatically add train tags extracted from safetensors to the prompt.  \nIf you find the automatically added tags intrusive, please adjust them.\n- Config -\u003e lora_block_weight  \nIf you do not need lbw, disable it.  \nIt is safer to use it when combining multiple lora, as it has the effect of making the image less likely to break up.  \n- Config -\u003e adetailer  \nIf you want to generate even higher quality images, set [person_yolov8n] to 1 and [face_yolov8n] to 2.\n- Config -\u003e segment_anything  \nSet sam model.  \nSet dino model.  \n( Retrieving the dino model name is not supported by the api, so you need to enter the model name by text.  \nSee sdwebui txt2img -\u003e Generation -\u003e Segment Anything -\u003e Enable GroundingDINO -\u003e GroundingDINO Model )  \n\n\n## Changelog\n### 2024-12-22\nAdded automatic generation of sequence file from image directories.  \nFixed a bug that dynamic prompt could not be used together.  \nUI Improvements.  \nSome bug fix  \n\n\n### Related resources\n- [Stable Diffusion Web UI(A1111)](https://github.com/AUTOMATIC1111/stable-diffusion-webui)\n- [sdwebuiapi](https://github.com/mix1009/sdwebuiapi)\n- [Stable-Diffusion-Webui-Civitai-Helper](https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper)\n- [adetailer](https://github.com/Bing-su/adetailer)\n- [sd-webui-controlnet](https://github.com/Mikubill/sd-webui-controlnet)\n- [sd-webui-lora-block-weight](https://github.com/hako-mikan/sd-webui-lora-block-weight)\n- [sd-webui-segment-anything](https://github.com/continue-revolution/sd-webui-segment-anything)\n- [stable-diffusion-webui-promptgen](https://github.com/AUTOMATIC1111/stable-diffusion-webui-promptgen)\n- [stable-diffusion-webui-promptgen](https://github.com/davidmartinrius/stable-diffusion-webui-promptgen/tree/api-implementation)\n- [wd-eva02-large-tagger-v3](https://huggingface.co/SmilingWolf/wd-eva02-large-tagger-v3)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs9roll7%2Fsd_batch_runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs9roll7%2Fsd_batch_runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs9roll7%2Fsd_batch_runner/lists"}