Skip to content

Commit

Permalink
Merge pull request #241 from pytorch/update_instructions_edit
Browse files Browse the repository at this point in the history
update instructions as per the latest public repos
  • Loading branch information
mycpuorg authored Apr 21, 2020
2 parents 16cafbf + 2e35197 commit f6c2d2c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 45 deletions.
38 changes: 2 additions & 36 deletions PyPiDescription.rst
Original file line number Diff line number Diff line change
@@ -1,50 +1,16 @@
Project Description
===================

TorchServe (PyTorch mdoel server) is a flexible and easy to use tool for
TorchServe (PyTorch model server) is a flexible and easy to use tool for
serving deep learning models exported from `PyTorch <http://pytorch.org/>`__.

Use the TorchServe CLI, or the pre-configured Docker images, to start a
service that sets up HTTP endpoints to handle model inference requests.

Prerequisites
-------------

* **java 8**: Required. TorchServe use java to serve HTTP requests. You must install java 8 (or later) and make sure java is on available in $PATH environment variable *before* installing torchserve. If you have multiple java installed, you can use $JAVA_HOME environment vairable to control which java to use.
* **PyTorch**: Required. Latest version of PyTorch will be installed as a part of TorchServe installation.

For ubuntu:
::

sudo apt-get install openjdk-8-jdk


For centos
::

sudo yum install java-1.8.0-openjdk


For Mac:
::

brew tap caskroom/versions
brew update
brew cask install java8


Install PyTorch:
::

pip install torch torchvision torchtext


Installation
------------

::

pip install torchserve
Full installation instructions are in the project repo: https://github.com/pytorch/serve/blob/master/README.md


Source code
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Conda instructions are provided in more detail, but you may also use `pip` and `
To use `pip` to install TorchServe and the model archiver:

```
pip install torch torchtext torchvision sentencepiece
pip install torchserve torch-model-archiver
```

Expand All @@ -32,8 +33,13 @@ _Ubuntu_
```
1. Install Conda (https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html)
1. Create an environment and install torchserve and torch-model-archiver
For CPU
```bash
conda create --name torchserve torchserve torch-model-archiver -c pytorch
conda create --name torchserve torchserve torch-model-archiver pytorch torchtext torchvision -c pytorch -c powerai
```
For GPU
```bash
conda create --name torchserve torchserve torch-model-archiver pytorch torchtext torchvision cudatoolkit=10.1 -c pytorch -c powerai
```
1. Activate the environment
```bash
Expand All @@ -47,10 +53,10 @@ _macOS_
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk11
```
1. Install Conda (https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html)
1. Install Conda (https://docs.conda.io/projects/conda/en/latest/user-guide/install/macos.html)
1. Create an environment and install torchserve and torch-model-archiver
```bash
conda create --name torchserve torchserve torch-model-archiver -c pytorch
conda create --name torchserve torchserve torch-model-archiver pytorch torchtext torchvision -c pytorch -c powerai
```
1. Activate the environment
```bash
Expand Down
30 changes: 24 additions & 6 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Create TorchServe docker image
# Create TorchServe docker image

```bash
cd serve/docker
Expand All @@ -7,21 +7,39 @@ git clone https://github.com/pytorch/serve.git

For creating CPU based image :
```bash
docker build --file Dockerfile.cpu -t torchserve:1.0 .
docker build --file Dockerfile.cpu -t torchserve:latest .
```

For creating GPU based image :
```bash
docker build --file Dockerfile.gpu -t torchserve:1.0 .
docker build --file Dockerfile.gpu -t torchserve:latest .
```

#### Start container with TorchServe image
## Start a container with a TorchServe image

The following examples will start the container with 8080/81 port exposed to outer-world/localhost.

### Start CPU container

For specific versions you can pass in the specific tag to use (ex: 0.1-cpu):
```bash
docker run --rm -it -p 8080:8080 -p 8081:8081 torchserve:1.0
docker run --rm -it -p 8080:8080 -p 8081:8081 pytorch/torchserve:0.1-cpu
```

The above command will start the container with 8080/81 port exposed to outer-world/localhost
For the latest version, you can use the `latest` tag:
docker run --rm -it -p 8080:8080 -p 8081:8081 pytorch/torchserve:latest

#### Start GPU container

For specific versions you can pass in the specific tag to use (ex: 0.1-cpu):
```bash
docker run --rm -it --gpus all -p 8080:8080 -p 8081:8081 pytorch/torchserve:0.1-cuda10.1-cudnn7-runtime
```

For the latest version, you can use the `gpu-latest` tag:
```bash
docker run --rm -it --gpus all -p 8080:8080 -p 8081:8081 pytorch/torchserve:latest-gpu
```

#### Accessing TorchServe APIs inside container

Expand Down

0 comments on commit f6c2d2c

Please sign in to comment.