Skip to content

safetensors.torch bug #5989

@lawrence-cj

Description

@lawrence-cj

Describe the bug

When using
import safetensors:


then safetensors.torch:
return safetensors.torch.load_file(checkpoint_file, device="cpu")

Bug reported AttributeError: module 'safetensors' has no attribute 'torch'.

Maybe we can change
from import safetensors
to import safetensors.torch as safetensors_torch

Reproduction

import safetensors
safetensors.torch

Logs

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'safetensors' has no attribute 'torch'

System Info

diffusers==0.23.0
safetensors==0.4.1

Who can help?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions