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

Merged
merged 15 commits into from
May 26, 2025

Conversation

kaixuanliu
Copy link
Contributor

No description provided.

@kaixuanliu
Copy link
Contributor 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
Contributor 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
Contributor Author

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

@kaixuanliu
Copy link
Contributor 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
Contributor Author

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

Copy link
Collaborator

@DN6 DN6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks you 🙏🏽 @kaixuanliu

@DN6 DN6 merged commit b5c2050 into huggingface:main May 26, 2025
12 checks passed
@DN6 DN6 mentioned this pull request May 26, 2025
6 tasks
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