使用 SageMaker 部署微调模型时设备上没有剩余空间

问题描述 投票:0回答:1

我使用 SageMaker JumpStartEstimator 对

huggingface-llm-mistral-7b
模型进行了微调。这些工件存储在 S3 中,压缩为
.tar.gz
文件。

现在我正在尝试部署上述模型。使用 python SDK 并运行以下代码:

INFERENCE_INSTANCE_TYPE = "ml.g5.2xlarge"
MODEL_ID = "huggingface-llm-mistral-7b"
MODEL_VERSION = "*"
SAGEMAKER_ROLE = "arn:aws:iam::257342474:role/AmazonSageMakerFullAccess"

endpoint_name = name_from_base(f"jumpstart-{MODEL_ID}")

deploy_image_uri = image_uris.retrieve(
    region=None,
    framework=None,
    image_scope="inference",
    model_id=MODEL_ID,
    model_version=MODEL_VERSION,
    instance_type=INFERENCE_INSTANCE_TYPE,
)
deploy_source_uri = script_uris.retrieve(
    model_id=MODEL_ID, model_version=MODEL_VERSION, script_scope="inference"
)
base_model_uri = model_uris.retrieve(
    model_id=MODEL_ID, model_version=MODEL_VERSION, model_scope="inference"
)
model = Model(
    image_uri=deploy_image_uri,
    source_dir=deploy_source_uri,
    model_data="s3://path/to/model/model.tar.gz",
    entry_point="inference.py",
    role=SAGEMAKER_ROLE,
    predictor_cls=Predictor,
    name=endpoint_name,
)

base_model_predictor = model.deploy(
    initial_instance_count=1,
    instance_type=INFERENCE_INSTANCE_TYPE,
    endpoint_name=endpoint_name,
    volume_size=50,
)

我得到的错误是:

OSError: [Errno 28] No space left on device

我的实例应该有足够的 RAM 和磁盘空间,我不明白为什么会出现此错误。

错误似乎来自模型创建步骤,因此我尝试将部署指令替换为:

model.create(instance_type=INFERENCE_INSTANCE_TYPE)

并且出现了同样的错误。

我还尝试增加卷大小,使用 ml.g5.12xlarge 实例以及使用 ServerlessInferenceConfig 但没有效果。

任何人都可以提供有关如何解决此问题或如何解决错误根源的建议吗?

python amazon-web-services amazon-sagemaker
1个回答
0
投票

我建议按照以下步骤调查该问题。

  1. 确定在开发环境(运行脚本的位置)和模型容器(托管端点)之间发生“设备上没有剩余空间”的环境。
  2. 检查完整的调用堆栈以了解错误的直接原因是什么。
  3. 如果容器中发生错误,请使用 SSM 访问容器
  4. 运行“df”命令查看环境的磁盘利用率,了解哪些磁盘空间达到100%。
© www.soinside.com 2019 - 2024. All rights reserved.