Skip to content

SageMaker adds wrong additional / when using S3DataSource with a nested structure #4249

Open
@philschmid

Description

@philschmid

Describe the bug
SageMaker adds wrongly / when using S3DataSource where files are stored in an nested order, see screenshot of how my s3 directory looks.
image

To reproduce

  1. Have a model with a nested structure, e.g. Stable Diffusion
  2. try to deploy the model using S3DataSource, e.g. below
from sagemaker.huggingface.model import HuggingFaceModel

# create Hugging Face Model Class
huggingface_model = HuggingFaceModel(
   model_data={'S3DataSource':{'S3Uri': s3_model_uri + "/",'S3DataType': 'S3Prefix','CompressionType': 'None'}},
   role=role,                      # iam role with permissions to create an Endpoint
   transformers_version="4.34.1",  # transformers version used
   pytorch_version="1.13.1",       # pytorch version used
   py_version='py310',             # python version used
   model_server_workers=1,         # number of workers for the model server
)

# deploy the endpoint endpoint
predictor = huggingface_model.deploy(
    initial_instance_count=1,      # number of instances
    instance_type="ml.inf2.xlarge", # AWS Inferentia Instance
    volume_size = 100
)
# ignore the "Your model is not compiled. Please compile your model before using Inferentia." warning, we already compiled our model.

Expected behavior
Deployed endpoint

Screenshots or logs
Error: UnexpectedStatusException: Error hosting endpoint huggingface-pytorch-inference-neuronx-2023-11-07-14-07-46-274: Failed. Reason: error: Key of model data S3 object 's3://sagemaker-us-east-2-558105141721/neuronx/sdxl//text_encoder/model.neuron' maps to invalid local file path..

System information
A description of your system. Please provide:

  • SageMaker Python SDK version: 2.197.0
  • Framework name (eg. PyTorch) or algorithm (eg. KMeans): huggingface
  • Framework version: 3.41.1
  • Python version: py310
  • CPU or GPU: Inf2
  • Custom Docker image (Y/N): N

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions