Skip to content

Commit 8e6d29d

Browse files
committed
Fix PyTorch SDK Failure
1 parent 0981118 commit 8e6d29d

File tree

4 files changed

+5
-38
lines changed

4 files changed

+5
-38
lines changed

buildspec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 0.2
22

33
env:
44
variables:
5-
FRAMEWORK_VERSION: '1.5.0'
5+
FRAMEWORK_VERSION: '1.6.0'
66
EIA_FRAMEWORK_VERSION: '1.3.1'
77
CPU_INSTANCE_TYPE: 'ml.c4.xlarge'
88
GPU_INSTANCE_TYPE: 'ml.p2.8xlarge'

src/sagemaker_pytorch_serving_container/torchserve.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
DEFAULT_TS_MODEL_DIRECTORY = os.path.join(os.getcwd(), ".sagemaker", "ts", "models")
4444
DEFAULT_TS_MODEL_NAME = "model"
4545
DEFAULT_TS_MODEL_SERIALIZED_FILE = "model.pth"
46+
DEFAULT_TS_CODE_DIR = "code"
4647
DEFAULT_HANDLER_SERVICE = "sagemaker_pytorch_serving_container.handler_service"
4748

4849
ENABLE_MULTI_MODEL = os.getenv("SAGEMAKER_MULTI_MODEL", "false") == "true"
@@ -121,7 +122,7 @@ def _adapt_to_ts_format(handler_service):
121122
"--export-path",
122123
DEFAULT_TS_MODEL_DIRECTORY,
123124
"--extra-files",
124-
os.path.join(environment.model_dir, environment.Environment().module_name + ".py"),
125+
os.path.join(environment.model_dir, DEFAULT_TS_CODE_DIR, environment.Environment().module_name + ".py"),
125126
"--version",
126127
"1",
127128
]
Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
11
ARG region
2-
FROM 763104351884.dkr.ecr.$region.amazonaws.com/pytorch-inference:1.5.0-cpu-py3
3-
4-
ARG TS_VERSION=0.1.1
5-
RUN apt-get update \
6-
&& apt-get install -y --no-install-recommends software-properties-common \
7-
&& add-apt-repository ppa:openjdk-r/ppa \
8-
&& apt-get update \
9-
&& apt-get install -y --no-install-recommends openjdk-11-jdk
10-
11-
RUN pip install torchserve==$TS_VERSION \
12-
&& pip install torch-model-archiver==$TS_VERSION
13-
14-
RUN pip uninstall torch \
15-
&& pip uninstall torchvision \
16-
&& pip install torch=1.6.0 \
17-
&& pip install torchvision=0.7.0
2+
FROM 763104351884.dkr.ecr.$region.amazonaws.com/pytorch-inference:1.6.0-cpu-py3
183

194
COPY dist/sagemaker_pytorch_inference-*.tar.gz /sagemaker_pytorch_inference.tar.gz
205
RUN pip install --upgrade --no-cache-dir /sagemaker_pytorch_inference.tar.gz && \
216
rm /sagemaker_pytorch_inference.tar.gz
22-
23-
CMD ["torchserve", "--start", "--ts-config", "/home/model-server/config.properties", "--model-store", "/home/model-server/"]
Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
11
ARG region
2-
FROM 763104351884.dkr.ecr.$region.amazonaws.com/pytorch-inference:1.5.0-cpu-py3
3-
4-
ARG TS_VERSION=0.1.1
5-
RUN apt-get update \
6-
&& apt-get install -y --no-install-recommends software-properties-common \
7-
&& add-apt-repository ppa:openjdk-r/ppa \
8-
&& apt-get update \
9-
&& apt-get install -y --no-install-recommends openjdk-11-jdk
10-
11-
RUN pip install torchserve==$TS_VERSION \
12-
&& pip install torch-model-archiver==$TS_VERSION
13-
14-
RUN pip uninstall torch \
15-
&& pip uninstall torchvision \
16-
&& pip install torch=1.6.0 \
17-
&& pip install torchvision=0.7.0
2+
FROM 763104351884.dkr.ecr.$region.amazonaws.com/pytorch-inference:1.6.0-gpu-py3
183

194
COPY dist/sagemaker_pytorch_inference-*.tar.gz /sagemaker_pytorch_inference.tar.gz
205
RUN pip install --upgrade --no-cache-dir /sagemaker_pytorch_inference.tar.gz && \
216
rm /sagemaker_pytorch_inference.tar.gz
22-
23-
CMD ["torchserve", "--start", "--ts-config", "/home/model-server/config.properties", "--model-store", "/home/model-server/"]

0 commit comments

Comments
 (0)