Skip to content

Biano-AI/TorchServe-u2net-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

U^2-Net TorchServe custom handler

Download pretrained model U^2-net or U^2-netp.

1. Pack model to .mar file

docker run --rm -it --name mar -v $(pwd)/output:/output -v \
$(pwd)/model:/model -v $(pwd)/src/:/src pytorch/torchserve:latest \
torch-model-archiver --model-name u2net --version ${MODEL_VERSION:-'1.0'} \
--model-file /src/u2net.py \
--serialized-file /model/u2net.pth --export-path /output \
--extra-files /src/unet_classes.py --handler /src/custom_handler.py

or

docker run --rm -it --name mar -v $(pwd)/output:/output -v \
$(pwd)/model:/model -v $(pwd)/src/:/src pytorch/torchserve:latest \
torch-model-archiver --model-name u2netp --version ${MODEL_VERSION:-'1.0'} \
--model-file /src/u2netp.py \
--serialized-file /model/u2netp.pth --export-path /output \
--extra-files /src/unet_classes.py --handler /src/custom_handler.py

2. Run TorchServe

docker run --rm -it -v $(pwd)/output:/home/model-server/model-store \
-v $(pwd)/config.properties:/tmp/config.properties \
-p 8080:8080 -p 8081:8081 -p 8082:8082 pytorch/torchserve:latest \
torchserve --start --model-store model-store --ts-config /tmp/config.properties

About

Custom TorchServe handler for U^2-Net

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages