Skip to content

Commit 0b63c53

Browse files
authored
SAI Vulnerability Fixes (aws#3594)
* SAI Vulnerabilities * Undo Dev Config
1 parent 9195df2 commit 0b63c53

File tree

6 files changed

+33
-10
lines changed

6 files changed

+33
-10
lines changed

release_images_inference.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,18 @@ release_images:
4242
disable_sm_tag: True # [Default: False] Set to True to prevent SageMaker Abbreviated Tags from being attached
4343
# to images being published.
4444
force_release: False # [Default: False] Set to True to force images to be published even if the same image
45-
# has already been published. Re-released image will have minor version incremented by 1.
45+
# has already been published. Re-released image will have minor version incremented by 1.
46+
4:
47+
framework: "stabilityai_pytorch"
48+
version: "2.0.1"
49+
arch_type: "x86"
50+
customer_type: "sagemaker"
51+
inference:
52+
device_types: ["gpu"]
53+
python_versions: ["py310"]
54+
os_version: "ubuntu20.04"
55+
cuda_version: "cu118"
56+
sgm_version: "0.1.0"
57+
example: False
58+
disable_sm_tag: False
59+
force_release: False

stabilityai/pytorch/inference/buildspec.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ images:
2323
BuildStabilityaiPytorchGpuPy310InferenceDockerImage:
2424
<<: *INFERENCE_REPOSITORY
2525
build: &STABILITYAI_PYTORCH_GPU_INFERENCE_PY3 false
26-
image_size_baseline: 14000
26+
image_size_baseline: 17000
2727
device_type: &DEVICE_TYPE gpu
2828
python_version: &DOCKER_PYTHON_VERSION py3
2929
tag_python_version: &TAG_PYTHON_VERSION py310
3030
cuda_version: &CUDA_VERSION cu118
3131
os_version: &OS_VERSION ubuntu20.04
3232
sgm_version: &SGM_VERSION 0.1.0
3333
tag: !join [ *VERSION, "-", 'sgm',*SGM_VERSION, '-', *DEVICE_TYPE, "-", *TAG_PYTHON_VERSION, "-", *CUDA_VERSION, "-", *OS_VERSION, "-sagemaker" ]
34-
docker_file: !join [ docker/, *SHORT_VERSION, /, *DOCKER_PYTHON_VERSION, /, *CUDA_VERSION, /Dockerfile.,
34+
docker_file: !join [ docker/, *SHORT_VERSION, /, *DOCKER_PYTHON_VERSION, /, *CUDA_VERSION, /Dockerfile., sagemaker.,
3535
*DEVICE_TYPE ]
3636
context:
3737
<<: *INFERENCE_CONTEXT

stabilityai/pytorch/inference/docker/2.0/py3/cu118/Dockerfile.gpu renamed to stabilityai/pytorch/inference/docker/2.0/py3/cu118/Dockerfile.sagemaker.gpu

+9-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ ARG PYTHON=python3
55
ARG XFORMERS_VERSION=0.0.20
66

77
# Resolve CVE
8-
RUN apt-get update
8+
RUN apt-get update \
9+
&& apt-mark hold libcudnn8 \
10+
&& apt-get upgrade -y \
11+
&& apt-get clean \
12+
&& rm -rf /var/lib/apt/lists/*
913
RUN pip --no-cache-dir install -U pip
10-
RUN apt-get install -y unattended-upgrades
11-
RUN unattended-upgrade
1214

1315
# xformers must be installed from source due to the older version of python in the DLC
1416
RUN pip install ninja \
@@ -36,8 +38,10 @@ RUN pip install --no-cache-dir -U \
3638
# Resolve CVE
3739
RUN pip install --no-cache-dir -U \
3840
werkzeug \
39-
urllib3 \
40-
opencv-python
41+
# Upper limit restriction by boto3
42+
urllib3==2.0.7 \
43+
opencv-python \
44+
pyarrow
4145

4246
# Configure Torchserve for large model loading
4347
ENV TS_DEFAULT_RESPONSE_TIMEOUT=1000

test/sagemaker_tests/pytorch/inference/integration/local/test_serving.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,13 @@ def _predictor(
158158
)
159159

160160
with local_mode_utils.lock():
161+
predictor = None
161162
try:
162163
predictor = model.deploy(1, instance_type)
163164
yield predictor
164165
finally:
165-
predictor.delete_endpoint()
166+
if predictor:
167+
predictor.delete_endpoint()
166168

167169

168170
def _assert_prediction_npy_json(predictor, test_loader, content_type, accept):

test/sagemaker_tests/pytorch/inference/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
boto3
22
coverage
3+
# Docker v7.0.0 breaks compatibility with Docker Compose v1 (SageMaker Local)
4+
docker<=6.1.3
35
docker-compose
46
Flask==1.1.1
57
fabric

test/test_utils/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ def get_dockerfile_path_for_image(image_uri, python_version=None):
287287
framework_path = framework.replace("_", os.path.sep)
288288
elif "habana" in image_uri:
289289
framework_path = os.path.join("habana", framework)
290+
elif "stabilityai" in framework:
291+
framework_path = framework.replace("_", os.path.sep)
290292
else:
291293
framework_path = framework
292294

@@ -317,7 +319,6 @@ def get_dockerfile_path_for_image(image_uri, python_version=None):
317319
neuron_sdk_version = get_neuron_sdk_version_from_tag(image_uri)
318320

319321
dockerfile_name = get_expected_dockerfile_filename(device_type, image_uri)
320-
321322
dockerfiles_list = [
322323
path
323324
for path in glob(os.path.join(python_version_path, "**", dockerfile_name), recursive=True)

0 commit comments

Comments
 (0)