AUTOMATIC1111/stable-diffusion-webui · error · ValueError
No GFPGAN model found
Error message
No GFPGAN model found
What it means
Raised by gfpgan_model.load_model after it iterated every candidate .pth file (found via modelloader with ext_filter ['.pth']) in the GFPGAN model directory and none had 'GFPGAN' in the filename basename, or none existed at all. It means no GFPGAN face-restoration weights are available where the loader expects them.
Source
Thrown at modules/gfpgan_model.py:44
def get_device(self):
return devices.device_gfpgan
def load_net(self) -> torch.Module:
for model_path in modelloader.load_models(
model_path=self.model_path,
model_url=model_url,
command_path=self.model_path,
download_name=model_download_name,
ext_filter=['.pth'],
):
if 'GFPGAN' in os.path.basename(model_path):
return modelloader.load_spandrel_model(
model_path,
device=self.get_device(),
expected_architecture='GFPGAN',
).model
raise ValueError("No GFPGAN model found")
def restore(self, np_image):
def restore_face(cropped_face_t):
assert self.net is not None
return self.net(cropped_face_t, return_rgb=False)[0]
return self.restore_with_helper(np_image, restore_face)
def gfpgan_fix_faces(np_image):
if gfpgan_face_restorer:
return gfpgan_face_restorer.restore(np_image)
logger.warning("GFPGAN face restorer not set up")
return np_image
def setup_model(dirname: str) -> None:
global gfpgan_face_restorer
View on GitHub (pinned to 82a973c043)
Solutions
- Put a valid GFPGAN weight file (e.g. GFPGANv1.4.pth) into the model directory shown by the loader (typically <webui-root>/models/GFPGAN) keeping 'GFPGAN' in the filename and a .pth extension.
- Or let the UI download it: open the Extras/face-restore tab and trigger the model download so modelloader fetches it from the registered model_url.
- Alternatively switch face restorer to CodeFormer if GFPGAN weights are unavailable.
Example fix
# before: file renamed so basename check fails models/GFPGAN/gfpgan_v14.pth # after: keep 'GFPGAN' and .pth in the name models/GFPGAN/GFPGANv1.4.pth
Defensive patterns
Strategy: validation
Validate before calling
import os, glob
def gfpgan_available(model_dir):
return any('GFPGAN' in os.path.basename(p)
for p in glob.glob(os.path.join(model_dir, '**', '*.pth'), recursive=True))
if shared.opts.face_restoration_model == 'GFPGAN' and not gfpgan_available('models/GFPGAN'):
print('GFPGAN weights missing; face restore will fail') Try / catch
try:
restorer = gfpgan_model.GfpganRestorer(...)
except ValueError as e:
if 'No GFPGAN model found' in str(e):
download_gfpgan_weights() # then retry once
else:
raise Prevention
- Keep GFPGAN weights at models/GFPGAN/GFPGANv1.4.pth with 'GFPGAN' in the basename.
- Check file presence at startup in unattended deployments before enabling restore_faces.
When it happens
Trigger: Enabling CodeFormer/GFPGAN face restore (restore_faces) with the GFPGAN restorer selected, while the models/GFPGAN directory is empty or contains no file whose basename contains 'GFPGAN' with a .pth extension.
Common situations: Fresh install where the automatic download failed or was skipped, the model file was renamed (e.g. to GFPGANv1.4.pth.backup), or it was placed in the wrong directory.
Related errors
- No codeformer model found
- When merging inpainting model with a normal one, A must be t
- When merging instruct-pix2pix model with a normal one, A mus
- Model file {path} not found
- hypernetwork uses an unsupported activation function: {activ
AI-assisted analysis of AUTOMATIC1111/stable-diffusion-webui@82a973c043 (2026-08-14).
Data as JSON: /api/errors/dd41478c837c0edc.
Report an issue: GitHub.