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

Replace pooch retrieve calls with create followed by fetch to benefit from the retry_if_failed feature #666

Conversation

dimitribarbot
Copy link
Collaborator

@dimitribarbot dimitribarbot commented Aug 26, 2024

This is a replacement of pooch.retrieve with pooch.create and pooch.fetch to allow the use of the retry_if_failed parameter.

For the moment, I only did the modification for the BiRefNet sessions as they were the ones that were crashing but this modification can also be applied to other sessions as well (except sam and unet_custom that are too specific). Let me know if you'd like me to adapt other sessions as well.

Please, don't hesitate to tell me if it's not relevant anymore as you already fixed the test issue (but I guess it may be helpful for end users to have retries as well, just in case).

@dimitribarbot
Copy link
Collaborator Author

dimitribarbot commented Aug 26, 2024

I was not lucky. My PR was pushed just at the same moment as a new major release of watchdog, the 5.0.0 version, that leads to the following errors in this Lint GitHub Action : https://github.com/danielgatis/rembg/actions/runs/10567877986/job/29277894544.

They say in their release notes that it is not compatible anymore with python 3.8. I see in your setup.py that you're library should be compatible with python 3.8. That's why I pushed a correction by adding an upper bound to the version of watchdog which should be strictly below 5.0.0 and it's working now. I'm not sure if you want to fix it that way though.

@danielgatis
Copy link
Owner

@dimitribarbot Let's avoid changing so much code just because of the tests. I think we've already solved the issue with downloading the models.

Let's close this for now; I hope you don't mind.

@dimitribarbot
Copy link
Collaborator Author

No I don't mind, I agree. Thank you for your help!

@dimitribarbot dimitribarbot deleted the replace-pooch-retrieve-with-create-and-fetch branch August 26, 2024 23:04
@dimitribarbot
Copy link
Collaborator Author

However, new users installing rembg may face the watchdog issue, no ? To my understanding, as there is no upper limit for watchdog version in the setup.py, by default the 5.0.0 version may be installed. It seems to break stuffs in on_any_event in p_command.py and maybe other things, as they say they're not compatible with python 3.8 anymore.

@danielgatis
Copy link
Owner

danielgatis commented Aug 26, 2024

@dimitribarbot yeah, you are correct. We need to fix this one.
It would be perfect if there were a way to lock the watchdog version specifically for Python 3.8

@dimitribarbot
Copy link
Collaborator Author

I know, as described in setuptools doc, that you can specify which versions to install based on the user's version of Python, e.g.:

setup(
    ...,
    install_requires=[
        "watchdog;python_version>='3.9'",
        "watchdog < 5.0.0;python_version<'3.9'",
    ],
)

But unfortunately, I don't know of any automated way to detect the latest version of a package dependency that is compatible with a specific version of Python.

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.

2 participants