For detailed README file, please see anthoer repository TorchServe Deployment (simplified Chinese only).
https://pytorch.org/serve/getting_started.html
- Put script model under root folder of project, then the project structure will be like:
.
├── script_model.pt <--- torch script model file
├── config.properties
├── curl.sh
├── data.json
├── handler.py
├── index_to_name.json
├── restart.sh
└── stop.sh
- Edit
restart.sh
, modify the project root path in line 1 and modify the conda activate path in line 2; - Edit
curl.sh
, modify the service request url and choose the right method to send request; - Edit
data.json
; - Edit
handler.py
to process request data and prediction result; - Edit
index_to_name.json
, mapping index and class name;
Give execute permission to the .sh
files:
chmod +x restart.sh curl.sh stop.sh
- Execute
restart.sh
to start torchserve service; - Execute
curl.sh
to test torchserve service; - Execute
stop.sh
to stop torchserve service;