-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Model Zoo API #355
Model Zoo API #355
Conversation
This pull request introduces 9 alerts when merging 9d0b826 into f1cb2cf - view on LGTM.com new alerts:
|
This pull request introduces 3 alerts when merging 652225c into f1cb2cf - view on LGTM.com new alerts:
|
This pull request introduces 3 alerts when merging 8c06863 into adef8dd - view on LGTM.com new alerts:
|
This pull request introduces 3 alerts when merging dade22a into adef8dd - view on LGTM.com new alerts:
|
@@ -0,0 +1,117 @@ | |||
modelDict = {"bertsquad-10" : "https://github.com/onnx/models/blob/master/text/machine_comprehension/bert-squad/model/bertsquad-10.onnx?raw=true" , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR. It is an awesome work.
One question:
Are these model urls here hard-coded?
If yes, I think maybe these urls can be parsed from onnx/models automatically. (finding those onnx models under model/ directory)
In that case, this API can be automatically updated while new models are introduced to model zoo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used the generate_models.py file to generate the links of the models automatically. It is included in the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kundanapillari - is it necessary to include this dictionary directly? Since we've included the scripts to dynamically generate these files, can they be generated in the initialization step?
The problem is that we'll continually have to keep updating this dictionary of models if we check this in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think one issue with having the dictionary be generated in the initialization step is that the user has to have an updated cloned repository for it to be able to traverse through the model zoo and create the dict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great start!
|
Superceded by #455 |
Python-API-Script
Onnx Python API Script used to download and save pretrained models from onnx model zoo. Retrieves metadata after the model is successfully downloaded.
Features
get_model_versions(MODEL_FOLDER_NAME)
- Retrieves an array of all the versions of the specificed model folder in the Onnx Model Zoo.get_pretrained()
- Downloads and saves specific onnx models to desired path.get_metadata()
- Retrieves metadata of the onnx model.Intialization and Usage
Initiate the object by calling onnx_zoo class name.
The Python scipt will then ask to input the model folder name. When inputting the name, it should be in all lowercase.
After model folder name is inputted, the script will output all the model versions that exist in the folder.
From the array of versions, input the version that will be downloaded and input the local directory that the model will be saved in.
To download the model and output its metadata, run the following functions:
Installation
Install onnx to check models
pip install onnx
Install onnxruntime to run onnx models
pip install onnxruntime
Contributors