RepoPilot

automatic1111 / stable-diffusion-webui

Search automatic1111/stable-diffusion-webui

GitHub

Code

How automatic1111/stable-diffusion-webui is laid out, and where to start for common changes.

There is no import map for this report yet.

Where to start reading

  1. Repository root
  2. Repository root
  3. Likely public API
  4. Suggested starting pointAI
  5. Suggested starting pointAI
  6. Suggested starting pointAI
  7. Suggested starting pointAI
  8. Suggested starting pointAI

Find files for a task

AI

Add a LoRA-style Parameter Adapter

  • Subclass the base network in extensions-builtin/Lora/network.py to define parameter structure
  • Implement weight forward hooks and apply_to() method to integrate with UNet/CLIP modules
  • Add loading logic in extra_networks_lora.py to detect and bind .safetensors files from models/ directory
  • Register in the extensions framework so API and UI discover the new parameter type

Add a New Upscaler Post-processor

  • Create extension directory under extensions-builtin/ with preload.py for model initialization
  • Implement model loading and inference in a module mirroring the SwinIR or LDSR pattern
  • Wire the upscaler into the processing pipeline via modules/processing_scripts/
  • Expose via REST API in modules/api/models.py if user-selectable

Add a REST API Endpoint

  • Define Pydantic request/response schemas in modules/api/models.py
  • Create handler function in modules/api/api.py and register with Gradio Interface
  • Use modules/call_queue.py to queue long-running operations and prevent blocking

Add Custom Textual Inversion Optimization

  • Create optimization schedule in modules/textual_inversion/learn_schedule.py
  • Implement embedding training loop in modules/textual_inversion/textual_inversion.py
  • Add dataset utilities in modules/textual_inversion/dataset.py for image sampling
  • Wire into UI via modules/textual_inversion/ui.py with progress callbacks

Change the public API

Add or update tests

Change build or automation

RepoPilot lists up to 500 files, so a file missing here may still exist.

  • Files marked “likely” are guessed from their names.

Code quality and hotspots

Largest source files

  • Branch points50 per file on average
  • Code issues0 errors, 161 warnings
  • Largest file1,793 lines
  • Hotspot load0 high-risk files

Static checks on the 15 largest source files.

Tests, CI and tooling

  • CIGitHub Actions3 workflows
  • Tests13 test filesPytest · 0.06 test files per source file (file count, not coverage)
  • Dependency updatesNo config detected

Test folders: test · test/test_files · test/test_outputs

Hotspots

Files that change often and branch heavily, highest first. Branch points count if, loop, case, catch, ternary, && and || in the file.