-
Notifications
You must be signed in to change notification settings - Fork 57
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
refactor: convert prepare-test-weights.sh to python #152
Conversation
ecb7a71
to
8b86d11
Compare
8b86d11
to
68f2efe
Compare
68f2efe
to
332ffa8
Compare
332ffa8
to
d7feb26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if converted weights exist and match hash. skip if thats the case
This one would be useful (in combination with skipping the downloads if files exists, it will make re-running the script very cheap). I suggest you add it.
I tried the script and conversion failed for SAM (I did not yet investigate if this is due to the script or not):
You will also need to change CONTRIBUTING.md
which references the old script.
This is unrelated with your changes, so you can ignore it (it fails on a specific machine, the difference is probably due to something related to torch). |
Ran successfully to completion. But on a repeat run `convert_unclip` didn't pass the hash check for some reason. - fix inpainting model download urls - shows a progress bar for downloads - skips downloading existing files - uses a temporary file to prevent partial downloads - can do a dry run to check if url is valid `DRY_RUN=1 python scripts/prepare_test_weights.py` - displays the downloaded file hash
d7feb26
to
f6a6e14
Compare
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still things that could be improved, for instance: why shell out to curl in convert_preprocessors
instead of using download_file
?
However in its current state it works and it is undeniably an improvement, so let's merge and change it later if needed!
I used chatgpt to do the first pass at the conversion to python and then went and cleaned it up a lot. Missed that curl call- my bad! |
This does feel a lot nicer to run but it is admittedly a mostly useless refactor (in that the previous version was mostly working).
This is in preparation for wanting to re-use components of this for a similar script that outputs all the needed mapping to do load-time conversion.
Ran successfully to completion. But on a repeat run
convert_unclip
didn't pass the hash check for some reason.Features
fixes inpainting model download urls. some of the urls for the bash script were incorrect and the errors ignoredDRY_RUN=1 python scripts/prepare_test_weights.py
Further refactoring could be done:
main
branch names in urls for better reliabilityBut I wanted to leave the script in a format that would still look somewhat recognizable.
Screenshots