A model archive is a TorchServe .mar package that bundles model files, metadata, and execution code so a generic prediction API can serve models without knowing their algorithm or data schema. section 7.2.6
A typical archive assigns these responsibilities:
- Model weights provide the serialized PyTorch model, commonly as a .pt or .pth file. section 7.2.6
- The handler implements model initialization, input preprocessing, inference, and prediction postprocessing. section 7.2.6
- Metadata identifies the model name, version, serialized file, runtime, and handler so TorchServe can load the package. section 7.2.6
Package an intent model
Create an archive with torch-model-archiver by supplying the model name, version, model implementation, serialized weights, handler, and extra files. The same package can be created in training code with model_archiver.archive(...).
TorchServe loads the archive into a worker process and invokes its handler when a prediction request arrives. Pure PyTorch model files cannot be loaded directly. section 7.2.6 section 7.4.2
