Skip to content
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

fix: Avoid downloading unsafe .bin files if a safetensors file is ava… #7282

Merged

Conversation

brandonrising
Copy link
Collaborator

…ilable

Summary

Currently, if we don't detect any variants in a hf repo, we just download everything. This PR is an attempt to start avoiding downloading .bin files when we detect that a safetensors file is available in the same directory.

QA Instructions

Install facebook/sam-vit-large and ensure the .bin file is not downloaded and the model still functions properly.
Attempt to install mohsen2/pytorch_model.bin or a similar hf repo with only .bin files and ensure the .bin is downloaded properly

  • You can close the invoke process while its downloading to avoid actually putting it on your computer

Merge Plan

Can be merged when approved

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added python PRs that change python files backend PRs that change backend files labels Nov 6, 2024
Copy link
Collaborator

@psychedelicious psychedelicious left a comment

Choose a reason for hiding this comment

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

Testing from a fresh env:

  • Downloaded each of the starter bundles (SD1.5, SDXL, FLUX)
  • Generating with SD1.5 + a couple ControlNets
  • Using Select Object
  • Using some filters which require a model to be run (OpenPose, LineArt)

No issues, and the SAM model only downloaded the one file. Nice!

@psychedelicious psychedelicious mentioned this pull request Nov 7, 2024
2 tasks
@hipsterusername hipsterusername merged commit 8a4c629 into main Nov 7, 2024
14 checks passed
@hipsterusername hipsterusername deleted the brandon/avoid-bin-models-when-safetensors-available branch November 7, 2024 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend PRs that change backend files python PRs that change python files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants