Skip to content

Commit

Permalink
updated model archiver documentation with details for reqirements file
Browse files Browse the repository at this point in the history
  • Loading branch information
harshbafna committed Aug 3, 2020
1 parent 6e66767 commit bf593e2
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion model-archiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* [Serialized File](#serialized-file)
* [handler](#handler)
* [Quick Start: Creating a Model Archive](#creating-a-model-archive)
* [Model specific custom python requirements](#model-specific-custom-python-requirements)

## Overview

Expand Down Expand Up @@ -112,7 +113,7 @@ optional arguments:
name in the path specified by --export-path will
overwritten
-v, --version Model's version.
-r, -requirements-file
-r, --requirements-file
Path to requirements.txt file containing a list of model specific python
packages to be installed by TorchServe for seamless model serving.
```
Expand Down Expand Up @@ -147,6 +148,9 @@ Handler can be TorchServe's inbuilt handler name or path to a py to handle custo
4. `image_segmenter`

For more details refer [default handler documentation](../docs/default_handlers.md)

Refer [TorchServe documentation](../docs/custom_service.md) to develop custom inference services/handlers.

## Creating a Model Archive

**1. Download the torch model archiver source**
Expand All @@ -171,3 +175,15 @@ torch-model-archiver --model-name densenet_161 --version 1.0 --model-file model.
```

This will package all the model artifacts files and output `densenet_161.mar` in the current working directory. This `.mar` file is all you need to run TorchServe, serving inference requests for a simple image recognition API. Go back to the [Serve a Model tutorial](../README.md#serve-a-model) and try to run this model archive that you just created!


### Model specific custom python requirements
Custom models/handlers may depend on different python packages which are not installed by-default as a part of `TorchServe` setup.
Supply a [python requirements](https://pip.pypa.io/en/stable/user_guide/#requirements-files) file containing the list of required python packages to be installed by `TorchServe` for seamless model serving using `--requirements-file` parameter while creating the model-archiver.

Example:
```bash
torch-model-archiver --model-name densenet_161 --version 1.0 --model-file model.py --serialized-file model.pt --handler image_classifier --requirements-file <path_to_custom_requiremnets_file>
```

**Note**: This feature is by-default disabled in TorchServe and needs to be enabled through configuration. For more details refer [TorchServe's configuration documentation](../docs/configuration.md#allow-model-specific-custom-python-packages)

0 comments on commit bf593e2

Please sign in to comment.