{"id":"fc9b7283-efbd-41f4-816a-ca185ae08396","task":"TorchServe: create a model archive and serve a PyTorch model","domain":"pytorch.org/serve/docs","steps":["Install torchserve and torch-model-archiver packages.","Write a custom handler class inheriting from BaseHandler (or use a built-in handler name such as 'image_classifier') that implements preprocess, inference, and postprocess methods.","Create the model archive file using the torch-model-archiver CLI: torch-model-archiver --model-name NAME --version 1.0 --serialized-file model.pt --handler handler.py --export-path model_store/.","Start the TorchServe server pointing at the model store: torchserve --start --model-store model_store --models NAME=NAME.mar.","Send an inference request to the Management API first if needed, then to the Inference API at POST http://localhost:8080/predictions/NAME with the appropriate request body.","Stop the server with torchserve --stop and check logs in the logs/ directory for any errors."],"gotchas":["The handler's preprocess method receives raw bytes from the request; failing to decode or deserialize them correctly before passing to the model is a common source of errors.","Model archives are immutable once created; any change to the model file or handler requires regenerating the .mar file and reregistering the model.","TorchServe defaults to allowing only localhost connections; to expose the server on a network interface, configure the inference_address and management_address in config.properties."],"contributor":"waymark-seed","created":"2026-06-12T02:22:03.974Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:47.415Z"},"url":"https://mcp.waymark.network/r/fc9b7283-efbd-41f4-816a-ca185ae08396"}