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

Hub model import script improvements #461

Merged
merged 3 commits into from
Apr 27, 2022

Conversation

dolaru
Copy link
Member

@dolaru dolaru commented Apr 21, 2022

Changes

Better logging

Switched from print statements to logging for a cleaner and more informative output - timestamps and log level are shown. The logging is now a bit more verbose, but it will help users to better understand what the script is doing.

Add support for ES authentication using username/password or api key

Instead of being limited to passing credentials in the URL, there are now 2 additional methods:

  • username/password using --es-username and --es-password
  • API key using --es-api-key

Credentials can also be specified as environment variables with ES_USERNAME/ES_PASSWORD or ES_API_KEY

Graceful handling of missing PyTorch requirements

In order to use the eland_import_hub_model script, PyTorch extras are required to be installed. If the user does not have the required packages installed, a helpful message is logged with a hint to install eland[pytorch] with pip.

Graceful handling of already existing trained model

If a trained model with the same ID as the one we're trying to import already exists, and --clear-previous was not specified, we now log a clearer message about why the script can't proceed along with a hint to use the --clear-previous flag.

Prior to this change, we were letting the API exception seep through and the user was faced with a stack trace.

tqdm added to main dependencies

If the user doesn't have eland[pytorch] extras installed, the first module to be reported as missing is tqdm. Since this module is used in eland codebase directly, it makes sense to me to have it as part of the main set of requirements.

Nit: Set tqdm unit to parts in _pytorch_model.put_model

The default unit is it, but parts better describes what the progress bar is tracking - uploading trained model definition parts.

@dolaru dolaru changed the title Hub import improvements Hub model import script improvements Apr 21, 2022
@dolaru dolaru self-assigned this Apr 21, 2022
@dolaru dolaru added the enhancement New feature or request label Apr 21, 2022
@dolaru dolaru force-pushed the hub_import_improvements branch from 05e99c3 to 0a69eb8 Compare April 21, 2022 15:45
@dolaru dolaru requested review from benwtrent and sethmlarson April 21, 2022 15:49
Copy link
Member

@benwtrent benwtrent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one comment on ignore= being deprecated:

dolaru added 3 commits April 27, 2022 13:30
- Move bulky code out of `__main__`
- Add support for authentication using username/password or api key
- Graceful handling of missing PyTorch requirements
- Graceful handling of already existing trained model
- Use logging instead of print statements
- Make logging a bit more verbose
@dolaru dolaru force-pushed the hub_import_improvements branch from 0a69eb8 to 987b759 Compare April 27, 2022 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants