Skip to content

Commit 26832aa

Browse files
authored
[docs] Improve safetensors docstring (#3368)
* clarify safetensor docstring * fix typo * apply feedback
1 parent c559479 commit 26832aa

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Diff for: src/diffusers/loaders.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1221,10 +1221,10 @@ def from_ckpt(cls, pretrained_model_link_or_path, **kwargs):
12211221
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
12221222
git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any
12231223
identifier allowed by git.
1224-
use_safetensors (`bool`, *optional* ):
1225-
If set to `True`, the pipeline will be loaded from `safetensors` weights. If set to `None` (the
1226-
default). The pipeline will load using `safetensors` if the safetensors weights are available *and* if
1227-
`safetensors` is installed. If the to `False` the pipeline will *not* use `safetensors`.
1224+
use_safetensors (`bool`, *optional*, defaults to `None`):
1225+
If set to `None`, the pipeline will load the `safetensors` weights if they're available **and** if the
1226+
`safetensors` library is installed. If set to `True`, the pipeline will forcibly load the models from
1227+
`safetensors` weights. If set to `False` the pipeline will *not* use `safetensors`.
12281228
extract_ema (`bool`, *optional*, defaults to `False`): Only relevant for
12291229
checkpoints that have both EMA and non-EMA weights. Whether to extract the EMA weights or not. Defaults
12301230
to `False`. Pass `True` to extract the EMA weights. EMA weights usually yield higher quality images for

Diff for: src/diffusers/models/modeling_utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,10 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
406406
variant (`str`, *optional*):
407407
If specified load weights from `variant` filename, *e.g.* pytorch_model.<variant>.bin. `variant` is
408408
ignored when using `from_flax`.
409-
use_safetensors (`bool`, *optional* ):
410-
If set to `True`, the pipeline will forcibly load the models from `safetensors` weights. If set to
411-
`None` (the default). The pipeline will load using `safetensors` if safetensors weights are available
412-
*and* if `safetensors` is installed. If the to `False` the pipeline will *not* use `safetensors`.
409+
use_safetensors (`bool`, *optional*, defaults to `None`):
410+
If set to `None`, the `safetensors` weights will be downloaded if they're available **and** if the
411+
`safetensors` library is installed. If set to `True`, the model will be forcibly loaded from
412+
`safetensors` weights. If set to `False`, loading will *not* use `safetensors`.
413413
414414
<Tip>
415415

Diff for: src/diffusers/pipelines/pipeline_utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -814,10 +814,10 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
814814
also tries to not use more than 1x model size in CPU memory (including peak memory) while loading the
815815
model. This is only supported when torch version >= 1.9.0. If you are using an older version of torch,
816816
setting this argument to `True` will raise an error.
817-
use_safetensors (`bool`, *optional* ):
818-
If set to `True`, the pipeline will be loaded from `safetensors` weights. If set to `None` (the
819-
default). The pipeline will load using `safetensors` if the safetensors weights are available *and* if
820-
`safetensors` is installed. If the to `False` the pipeline will *not* use `safetensors`.
817+
use_safetensors (`bool`, *optional*, defaults to `None`):
818+
If set to `None`, the pipeline will load the `safetensors` weights if they're available **and** if the
819+
`safetensors` library is installed. If set to `True`, the pipeline will forcibly load the models from
820+
`safetensors` weights. If set to `False` the pipeline will *not* use `safetensors`.
821821
kwargs (remaining dictionary of keyword arguments, *optional*):
822822
Can be used to overwrite load - and saveable variables - *i.e.* the pipeline components - of the
823823
specific pipeline class. The overwritten components are then directly passed to the pipelines

0 commit comments

Comments
 (0)