Skip to content

Fix bug when variant and safetensor file does not match #11587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

kaixuanliu
Copy link

No description provided.

@kaixuanliu
Copy link
Author

This PR fixes bug under is_safetensors_compatible function: when variant and safetensor file does not match, this function should return False. For example, in this model: stable-diffusion-v1-5/stable-diffusion-inpainting, there is file diffusion_pytorch_model.fp16.safetensors, but when variant is None, it should return False instead of True

@kaixuanliu
Copy link
Author

@a-r-r-o-w @DN6 , pls help review, thx.

@DN6
Copy link
Collaborator

DN6 commented May 20, 2025

@bot /style

Copy link
Contributor

Style fixes have been applied. View the workflow run here.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@DN6
Copy link
Collaborator

DN6 commented May 20, 2025

Thanks @kaixuanliu! I think we would need to add the variant check when there are no component folders as well.

    if not components:
        return any(".safetensors" in filename for filename in filenames)

And I think the changes will break the current is_safetensors_compatible tests here

class IsSafetensorsCompatibleTests(unittest.TestCase):

@kaixuanliu
Copy link
Author

@DN6 , Hi, thanks for your advice. Have updated the code and test cases

@kaixuanliu
Copy link
Author

@bot /style

1 similar comment
@DN6
Copy link
Collaborator

DN6 commented May 21, 2025

@bot /style

Copy link
Contributor

Style fixes have been applied. View the workflow run here.

@kaixuanliu
Copy link
Author

@DN6 Hi, I have checked all the CI tests offline. Can you help trigger the CI workflow again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants