This template environment can be used to create artifact-only PyTorch custom models. Your custom model directory needs only contain your model artifact if you use the environment correctly.
This environment has built for python 3 and has support for the following scientific libraries. For specific version information, see requirements.
- PyTorch
- From the terminal, run
tar -czvf py_dropin.tar.gz -C /path/to/public_dropin_environments/python3_pytorch/ .
- Using either the API or from the UI create a new Custom Environment with the tarball created in step 1.
To use this environment, your custom model archive must contain a single serialized model artifact
with .pth
file extension as well as any other custom code needed to use your serialized model, including
the file that defines your torch network.
This environment makes the following assumption about your serialized model:
- The data sent to custom model can be used to make predictions without additional pre-processing
- Regression models return a single floating point per row of prediction data
- Binary classification models return one floating point value <= 1.0 or two floating point values that sum to 1.0 per row of prediction data.
- Single value output is assumed to be the positive class probability
- Multi value it is assumed that the first value is the negative class probability, the second is the positive class probability
- There is a single .pth file present
If these assumptions are incorrect for your model, you should make a copy of custom.py, modify it as needed, and include in your custom model archive.
The structure of your custom model archive should look like:
- custom_model.tar.gz
- artifact.pth
- custom.py (if needed)
Please read datarobot-cmrunner documentation on how to assemble custom.py.