REST API
The API exposes dataset and model endpoints from which one can setup and run actions.
User authentication is an incoming feature, and the API deployment includes ingress Kubernetes rules for this purpose. Until this feature is released, please do not expose the API outside of your private network without implementing your own user authentication mechanism.
Within the cluster, one can use the following command to know the cluster IP and cluster port of the service. The service cluster port should be 8000.
kubectl get services tao-toolkit-api-service
Within your private network, one can change the TAO Toolkit API Kubernetes service to request a NodePort that bypasses the NGINX ingress rules. For example:
kubectl patch services tao-toolkit-api-service --type='json' \
-p '[{"op":"replace","path":"/spec/type","value":"NodePort"}]'
kubectl get services tao-toolkit-api-service
The node port would be the number after the 8000 cluster port 8000:<NodePort>
, and the IP address would be the external IP of one of the cluster nodes.
A curl command would look like the following, where 172.17.169.89 is one of the node’s external IP, and 30108 is the NodePort for the API service.
curl http://172.17.169.89:30108/api/v1
And one can generate a new user ID with:
python3 -c "import uuid; print(str(uuid.uuid4()));"
The TAO Toolkit API service includes methods for dealing with the content of experimental workspaces, such as user datasets and models. It also includes methods for executing TAO actions applicable to data and specifications stored in such experimental workspaces.
A basic scenario would be for a user to first create a Dataset for a specific network type, create a Model experiment that is pointing to the dataset and a pretrained model, and customize specs before executing network-related actions.
/api/v1/dataset |
/api/v1/model |
---|---|
* List datasets for user |
* List models for user |
See the TAO API Specification <tao_api_specification> for more details.
For an example that demonstrates the Object Detection workflow, please find tutorial notebook api_tutorials/api/detectnet_v2.ipynb from resource archive: https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tao/resources/cv_samples
For an example that demonstrates the TTS finetune workflow, please find tutorial notebook api_tutorials/api/tts.ipynb from resource archive: https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tao/resources/texttospeech_notebook