-
Notifications
You must be signed in to change notification settings - Fork 245
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
Inconvenience Loading Several Models With Colliding Namespaces #185
Comments
@snakers4 Good point! btw we have documented a similar behavior in https://pytorch.org/docs/stable/hub.html#known-limitations which is a variant of issue raised here. |
I totally agree here.
I am not the biggest expert on how python internals work, but so far I have been able to replicate an error on a minimalist example (if this helps anyone): A minimal set up like this:
Error can be replicated like this:
I will report here if I find an easy solution |
A naïve solution I found:
works, but you have to manage imports inside of
thinking about a backwards compatible one |
I have tried various ideas how to make this work reverse compatible |
any news? I have problem with utils too. in my case one of the utils are in my environment, and I'm trying to load another model from hub, but I always get utils.x not found editing on
|
In your case you can try 2 obvious hacks:
|
Thank you, |
If you load 2+ models from
torch.hub
at the same time in the same process, they are treated like one namespace, i.e. if you have autils.py
module in both packages, it raises cryptic errors.This comment best describes this behavior - snakers4/silero-vad#28 (comment) - a used tried loading 2 models at the same time (I just renamed the
utils
module in one of them to avoid this).This is not really a problem and I am not sure this is intentional, but very many
torch.hub
packages haveutils.py
module.I understand that this can be solved with more proper packaging / containerization / CI, but since the ideology of
torch.hub
is to keep things minimal, this may become an issue in future.The text was updated successfully, but these errors were encountered: