Conversation
* Separate listing the names of modules from actually loading one.
* Module import for a model sometimes takes time, so it is helpful
to be able to filter by module name _before_ importing the module souce.
* Also allows manually looking up module `load_model('demucs')`
* Fixes an issue where demucs get_module was not returning a module.
[ghstack-poisoned]
* Separate listing the names of modules from actually loading one.
* Module import for a model sometimes takes time, so it is helpful
to be able to filter by module name _before_ importing the module souce.
* Also allows manually looking up module `load_model('demucs')`
* Fixes an issue where demucs get_module was not returning a module.
ghstack-source-id: c6b7dfc
Pull Request resolved: #158
| Model.name = model_name | ||
| models.append(Model) | ||
| return models | ||
| return (load_model(model_name) for model_name in model_names()) |
There was a problem hiding this comment.
i thought you wanted to decouple listing of models from loading them?
There was a problem hiding this comment.
or did you just want to decouple loading a model by name from having to load all the others?
There was a problem hiding this comment.
I made module_names public so if you wanted to separate the process you can. I didn't want to change the existing API for the case where you will just load everything.
There was a problem hiding this comment.
might still be useful to have list_models return a list of string names of directories in case one model isn't importable and it forces you to mv the dir out before anything works.
There was a problem hiding this comment.
I am not sure I am following. One thing to keep in mind is that load_model handles the import, so if you don't try to load a model it won't import it.
There was a problem hiding this comment.
ok i wrote my latest comment without seeing yours, that makes sense
Stack from ghstack:
[wip] some clean and code to package models #161 [wip] some clean and code to package models
List names, demucs cleanup #158 List names, demucs cleanup
Separate listing the names of modules from actually loading one.
Module import for a model sometimes takes time, so it is helpful
to be able to filter by module name before importing the module souce.
Also allows manually looking up module
load_model('demucs')Fixes an issue where demucs get_module was not returning a module.