Describe the bug
Three docstrings annotate a boolean parameter as `str`. Each is self-contradictory on its own
line, since it pairs the str type with a boolean default:
| Location |
Docstring says |
Real type |
src/diffusers/pipelines/pipeline_utils.py:423 |
silence_dtype_warnings (`str`, *optional*, defaults to `False`) |
bool |
src/diffusers/modular_pipelines/modular_pipeline.py:2612 |
same line, same parameter |
bool |
src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py:1213 |
from_safetensors (`str`, *optional*, defaults to `False`) |
bool (:1156 from_safetensors: bool = False) |
Evidence for each, from the surrounding code rather than from the parameter names:
silence_dtype_warnings — the same docstring's own signature examples three lines above
(pipeline_utils.py:408, :410, :412) all write silence_dtype_warnings=False. It is read as
kwargs.pop("silence_dtype_warnings", False) (:431), used as a plain condition (:588
and not silence_dtype_warnings), and internal callers pass True (:1230, :1344). The prose
right below it also reads "Whether to omit warnings…", which is boolean phrasing.
from_safetensors — annotated bool = False at :1156 and used as a bare condition at
:1269. The very next docstring entry, load_safety_checker (bool, *optional*, defaults to True),
is the correct spelling of the same shape.
Documentation only; no runtime behavior is affected. It is misleading for anyone reading the
reference docs, since str implies passing "False" — which is truthy.
Reproduction
import inspect, re
from diffusers import DiffusionPipeline
doc = DiffusionPipeline.to.__doc__
print(re.search(r"silence_dtype_warnings \(`(\w+)`", doc).group(1)) # str
print(inspect.signature(DiffusionPipeline.to)) # **kwargs; default is False
Logs
No response
System Info
Documentation-only issue, read from main.
Who can help?
@stevhliu
Note
A fix is already open as a PR linked to this issue — three one-line edits, str → bool. Filing
this because of the pr-link-issue reminder; not looking for anyone else to pick it up.
Found with an AST pass comparing each documented parameter type against its real annotation, which
reports only unambiguous simple-type contradictions (containers, unions, unannotated params, and
bool/int style differences are all skipped). It finds 0 further instances in src/diffusers
after this change.
Related but deliberately not in that PR, since it is a different problem class and would touch 19
files: 27 docstrings write a boolean default as a quoted string, e.g.
force_zeros_for_empty_prompt (`bool`, *optional*, defaults to `"True"`) in
pipeline_controlnet_sd_xl.py:222 where the signature is bool = True. Happy to send that as a
follow-up, per family or in one batch — your call on how you'd like it split.
Describe the bug
Three docstrings annotate a boolean parameter as
`str`. Each is self-contradictory on its ownline, since it pairs the
strtype with a boolean default:src/diffusers/pipelines/pipeline_utils.py:423silence_dtype_warnings (`str`, *optional*, defaults to `False`)src/diffusers/modular_pipelines/modular_pipeline.py:2612src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py:1213from_safetensors (`str`, *optional*, defaults to `False`):1156from_safetensors: bool = False)Evidence for each, from the surrounding code rather than from the parameter names:
silence_dtype_warnings— the same docstring's own signature examples three lines above(
pipeline_utils.py:408,:410,:412) all writesilence_dtype_warnings=False. It is read askwargs.pop("silence_dtype_warnings", False)(:431), used as a plain condition (:588and not silence_dtype_warnings), and internal callers passTrue(:1230,:1344). The proseright below it also reads "Whether to omit warnings…", which is boolean phrasing.
from_safetensors— annotatedbool = Falseat:1156and used as a bare condition at:1269. The very next docstring entry,load_safety_checker (bool, *optional*, defaults toTrue),is the correct spelling of the same shape.
Documentation only; no runtime behavior is affected. It is misleading for anyone reading the
reference docs, since
strimplies passing"False"— which is truthy.Reproduction
Logs
No response
System Info
Documentation-only issue, read from
main.Who can help?
@stevhliu
Note
A fix is already open as a PR linked to this issue — three one-line edits,
str→bool. Filingthis because of the
pr-link-issuereminder; not looking for anyone else to pick it up.Found with an AST pass comparing each documented parameter type against its real annotation, which
reports only unambiguous simple-type contradictions (containers, unions, unannotated params, and
bool/intstyle differences are all skipped). It finds 0 further instances insrc/diffusersafter this change.
Related but deliberately not in that PR, since it is a different problem class and would touch 19
files: 27 docstrings write a boolean default as a quoted string, e.g.
force_zeros_for_empty_prompt (`bool`, *optional*, defaults to `"True"`)inpipeline_controlnet_sd_xl.py:222where the signature isbool = True. Happy to send that as afollow-up, per family or in one batch — your call on how you'd like it split.