-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add user control for whether models are downloaded automatically #135
Labels
Comments
Hi @vrkosk, Thanks for the suggestion! We will look into adding this in MS²PIP, so a monkey patch is not required and it simply is provided as an option. If auto-download is disabled, and the required model is missing from the directory, you would expect an exception to be raised? Best, |
Thank you for considering it! Any way to signal the error is fine as long as it's in the MS2PIPFeatureGenerator documentation. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, when MS2PIPFeatureGenerator calls ms2pip.correlate(), the latter may download xgboost_models_files from the Internet if they are not present in the model_dir directory. Can we please have a control to disable this behaviour?
It's possible to do by monkey patching. At the top of your script, before importing anything from MS2Rescore or MS2PIP, add these lines:
The code targeted is in ms2pip/_utils/xgb_models.py, def _download_model(), which uses urllib.request.urlretrieve. The trick relies on the fact that there is always only one instance of an imported module, so messing with urllib.request before ms2pip imports it guarantees that ms2pip sees the same monkey-patched instance.
Obviously, this is rather poor practice and some option passed to MS2PIPFeatureGenerator would be much nicer.
The text was updated successfully, but these errors were encountered: