Skip to content

Commit

Permalink
Clarify "Load Model" SafeTensors documentation (#3028)
Browse files Browse the repository at this point in the history
The "Load Model" node description inaccurately implied that SafeTensors
wasn't supported. This was presumably because the documentation in
question was split between two files, and only one was updated.

This commit consolidates the supported file type documentation in one
file, so that this bug is less likely to happen again. This also avoids
making the description tooltip unwieldily verbose, as would have
happened if I had instead edited the description in-place.

Also note in the documentation that SafeTensors should be used for
better security, since it's not really reasonable to expect users to
read the Spandrel GitHub README to find that.

Co-authored-by: Jeremy Rand <[email protected]>
  • Loading branch information
JeremyRand and Jeremy Rand authored Sep 23, 2024
1 parent c852759 commit c859a6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 3 additions & 0 deletions backend/src/nodes/properties/inputs/file_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ def PthFileInput(primary_input: bool = False) -> FileInput:
file_kind="pth",
filetypes=[".pt", ".pth", ".ckpt", ".safetensors"],
primary_input=primary_input,
).with_docs(
"Supports PyTorch state dict (.pth), TorchScript (.pt), Checkpoint (.ckpt), or SafeTensors (.safetensors) files.",
"Use SafeTensors files for better security (the other file types might be able to execute arbitrary code when loaded).",
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ def parse_ckpt_state_dict(checkpoint: dict):
schema_id="chainner:pytorch:load_model",
name="Load Model",
description=[
(
"Load PyTorch state dict (.pth), TorchScript (.pt), or Checkpoint (.ckpt) files into an"
" auto-detected supported model architecture."
),
("Load PyTorch model file into an auto-detected supported model architecture."),
(
"- For Super-Resolution, we support most variations of the RRDB"
" architecture (ESRGAN, Real-ESRGAN, RealSR, BSRGAN, SPSR), Real-ESRGAN's"
Expand Down

0 comments on commit c859a6a

Please sign in to comment.