This document outlines the procedure to add new models into the MXNet model zoo.
An MXNet symbolic model usually contains the following files:
- <MODEL_NAME>-symbol.json
- <MODEL_NAME>-0000.params
Note: To save space, compress the parameter file to .gz using the following command:
$ gzip <MODEL_NAME>-0000.params
You might also need to provide other files with your model.
For example, a classification model is dependent on
a synset.txt
file to provide the names of the classes to classify into.
For an NLP model, you may need a vocabulary.json
file to tokenize and untokenize the sentence.
- Navigate to the
test/resources/mlrepo/model
folder and create a folder in it to store your model based on its category. For example,image_classification/ai/djl/mxnet/resnet
. - Create a version folder within your newly created model's folder (e.g.
0.0.1
). The version should match your ModelLoader class's version. - Copy model files into the version folder.
You need to create a metadata.json
file for the model zoo to load the model. You can refer to the format in the metadata.json
files for existing models to create your own.
Note: You need to update the sha1 hash of each file in your metadata.json
file. Use the following command to get the sha1Hash value:
$ shasum -a 1 <file_name>
Verify that your folder has the following files:
- /<model_name>-symbol.json
- /<model_name>-00xx.params.gz
- metadata.json
- ...
Then, run the following command to upload your model to the S3 bucket:
$ ./gradlew syncS3
You need to register your new model in the main model zoo interface. Be sure to include all the necessary information to load and use your model.
Note: Avoid checking in binary files to the git repository. Binary files should only be uploaded to the S3 bucket.
Update the mxnet-model-zoo/README.md file to keep the list of models up to date.