53 messages in src/diffusers are missing the f-string prefix (safety-checker ValueError in 46 pipelines)
Following the AI-assisted contribution guide, I'm opening one issue for a recurring pattern rather than per-file PRs, and I'll wait for a maintainer's go-ahead before opening a PR.
The pattern
53 messages under src/diffusers contain {...} placeholders but are plain strings, not f-strings, so users see the placeholder text instead of the value. Every referenced name is in scope at its call site, so the fix is only the f prefix. Found with an AST scan for string literals passed to raise, logger.* or print whose placeholders name variables in the enclosing function; each hit was then read by hand.
1. Safety-checker ValueError in 46 pipelines (the most user-visible one)
raise ValueError(
"Make sure to define a feature extractor when loading {self.__class__} if you want to use the safety"
" checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead."
)When safety_checker is passed without feature_extractor, the error reads ...when loading {self.__class__} if... instead of naming the pipeline class. None of these __init__s are # Copied from, so each copy needs the same one-character edit:
pipelines/controlnet/pipeline_controlnet.py:239pipelines/controlnet/pipeline_controlnet_img2img.py:217pipelines/controlnet/pipeline_controlnet_inpaint.py:220pipelines/controlnet_hunyuandit/pipeline_hunyuandit_controlnet.py:262pipelines/deepfloyd_if/pipeline_if.py:153pipelines/deepfloyd_if/pipeline_if_img2img.py:177pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py:183pipelines/deepfloyd_if/pipeline_if_inpainting.py:180pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py:185pipelines/deepfloyd_if/pipeline_if_superresolution.py:141pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion.py:252pipelines/deprecated/alt_diffusion/pipeline_alt_diffusion_img2img.py:280pipelines/deprecated/controlnet_xs/pipeline_controlnet_xs.py:177pipelines/deprecated/semantic_stable_diffusion/pipeline_semantic_stable_diffusion.py:85pipelines/deprecated/stable_diffusion_attend_and_excite/pipeline_stable_diffusion_attend_and_excite.py:245pipelines/deprecated/stable_diffusion_diffedit/pipeline_stable_diffusion_diffedit.py:345pipelines/deprecated/stable_diffusion_gligen/pipeline_stable_diffusion_gligen.py:169pipelines/deprecated/stable_diffusion_gligen/pipeline_stable_diffusion_gligen_text_image.py:230pipelines/deprecated/stable_diffusion_ldm3d/pipeline_stable_diffusion_ldm3d.py:260pipelines/deprecated/stable_diffusion_panorama/pipeline_stable_diffusion_panorama.py:231pipelines/deprecated/stable_diffusion_safe/pipeline_stable_diffusion_safe.py:125pipelines/deprecated/stable_diffusion_variants/pipeline_cycle_diffusion.py:213pipelines/deprecated/stable_diffusion_variants/pipeline_onnx_stable_diffusion_inpaint_legacy.py:138pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_inpaint_legacy.py:183pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_model_editing.py:111pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_paradigms.py:135pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_pix2pix_zero.py:353pipelines/hunyuandit/pipeline_hunyuandit.py:235pipelines/latent_consistency_models/pipeline_latent_consistency_text2img.py:207pipelines/ledits_pp/pipeline_leditspp_stable_diffusion.py:367pipelines/pag/pipeline_pag_controlnet_sd.py:247pipelines/pag/pipeline_pag_controlnet_sd_inpaint.py:221pipelines/pag/pipeline_pag_hunyuandit.py:240pipelines/pag/pipeline_pag_sd.py:258pipelines/pag/pipeline_pag_sd_img2img.py:253pipelines/pag/pipeline_pag_sd_inpaint.py:285pipelines/stable_diffusion/pipeline_onnx_stable_diffusion.py:101pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py:154pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint.py:153pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_upscale.py:127pipelines/stable_diffusion/pipeline_stable_diffusion.py:253pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py:103pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py:281pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py:228pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py:154pipelines/t2i_adapter/pipeline_stable_diffusion_adapter.py:256
2. DeepFloyd IF super-resolution warnings (3): "It seems like you have loaded a checkpoint that shall not be used for super resolution from {unet.config._name_or_path} as it accepts {unet.config.in_channels} input channels..." in pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py:189, pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py:191, pipelines/deepfloyd_if/pipeline_if_superresolution.py:147.
3. bitsandbytes quantizer (2): logger.info("target_dtype {target_dtype} is replaced by ...") in quantizers/bitsandbytes/bnb_quantizer.py:452, quantizers/bitsandbytes/bnb_quantizer.py:98.
4. DPMSolverSinglestepScheduler.set_timesteps warnings (2): "Changing scheduler {self.config} to have lower_order_final set to True..." in schedulers/scheduling_dpmsolver_singlestep.py:424, schedulers/scheduling_dpmsolver_singlestep.py:430.
Proposed fix
A single PR adding the f prefix at these 53 sites, with no other changes. It would pass make quality, make fix-copies (to confirm no copy checks drift), and the self-review skill, with the notes shared on the PR. There are also about 24 more copies of the safety-checker message under examples/community. I'd leave those out unless you'd like them in the same PR.
Would a PR along these lines be welcome?
Source: huggingface/diffusers