Skip to content

Conversation

@CalamitousFelicitousness
Copy link
Contributor

@CalamitousFelicitousness CalamitousFelicitousness commented Feb 9, 2026

Description

Remove CodeFormer and GFPGAN face restoration backends, which were the only two backends registered in shared.face_restorers. Their removal makes the entire face restoration infrastructure dead code, so this also cleans up all associated plumbing: the base class/dispatcher, vendored facelib library, ONNX face restorer helper, processing pipeline integration, API endpoints, CLI tools, settings, and UI references.

The YOLO-based detailer system is unaffected.

Notes

  • The sdnext-modernui submodule has a companion PR removing the GFPGAN/CodeFormer sections from the extras template
  • basicsr pip package is kept — it's still used by RealESRGAN, PuLID, and Midas
  • The ChaiNNer extension submodule has its own independent CodeFormer/GFPGAN code and is not modified
  • The [Postprocess] Detailer XYZ grid option was converted from a free-text str to a bool dropdown (False/True), since the old codeformer/gfpgan string values it accepted no longer exist
  • The /sdapi/v1/face-restorers API endpoint is removed, and gfpgan_visibility, codeformer_visibility, codeformer_weight fields are removed from the /sdapi/v1/extra-single-image request model — breaking API change for any external consumers using those fields, number of which probably is in high 0's.

Environment and Testing

  • Platform: Linux (WSL2 6.6.87.2-microsoft-standard-WSL2)
  • GPU: NVIDIA RTX 3090
  • Python: 3.12
  • Linting: ruff check and pylint

Remove all vendored face restoration code that is no longer maintained:

- modules/postprocess/codeformer_model.py, codeformer_arch.py, vqgan_arch.py
- modules/postprocess/gfpgan_model.py, restorer.py
- modules/face_restoration.py (base class and dispatcher)
- scripts/postprocessing_codeformer.py, postprocessing_gfpgan.py
- modules/facelib/ (vendored face detection/parsing library)

These were the only two backends registered in shared.face_restorers,
making the entire face restoration infrastructure dead code.
- Remove CodeFormer/GFPGAN import and setup from webui.py initialize()
- Remove face_restorers list, codeformer/gfpgan model path settings,
  and face restore UI settings section from shared.py
- Remove restore_faces parameter from StableDiffusionProcessing
- Remove face_restoration import and restore_faces processing block
  from processing.py
- Remove /sdapi/v1/face-restorers route from api.py
- Remove get_restorers() function from endpoints.py
- Remove gfpgan_visibility, codeformer_visibility, codeformer_weight
  fields from ReqProcess model
- Remove GFPGAN and CodeFormer entries from run_extras() signature
  and create_args_for_run dict in postprocessing.py
- Remove codeformer, restoreformer, GFPGANv1.4, and GPEN-BFR ONNX
  model URLs from the predefined list
- Remove the .fp16 ONNX restorer code path that bypassed detailer
  processing to run face restoration directly
- Remove gfpgan/codeformer face template lines from cli/generate.py
- Remove gfpgan_visibility, codeformer_visibility, codeformer_weight
  from cli/generate.json upscale config
- Simplify cli/process.py upscale_restore_image() to remove the
  restore path and codeformer parameters
- Remove codeformer/gfpgan special cases from xyz_grid_shared.py
  apply_detailer(), keep generic boolean parsing
- Remove p.restore_faces assignment from xyz_grid_on.py
- Remove GFPGAN pip install from installer.py optional requirements
- Remove 'gfpgan' from modules_to_remove cleanup list in launch.py
- Remove --codeformer-models-path and --gfpgan-models-path CLI args
- Remove GFPGAN model directory migration from modelloader.py
- Remove GFPGAN and CodeFormer sections from Modern UI extras template
- Remove CodeFormer S-Lab license block from licenses.html
- Update Postprocessing hint in locale_en.json
- Remove completed TODO items for CodeFormer/GFPGAN removal
- Change AxisOption type from str to bool with [False, True] choices
- Simplify apply_detailer() to accept bool directly
- Fix log message from "face-restore" to "detailer"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant