7

当我在使用自定义容器部署的 sagemaker 中调用端点/批处理作业时,我想在 S3 中存储一些信息。例如,在这张图片中 在此处输入图像描述

在“部署/托管”中,我想将一些对象放入 S3 容器中,而不仅仅是读取 /opt/model

例如BYO 容器 R

在水管工.R 功能中,我想:

function(req) {

    # Setup locations
    prefix <- '/opt/ml'
    model_path <- paste(prefix, 'model', sep='/')

    # Bring in model file and factor levels
    load(paste(model_path, 'mars_model.RData', sep='/'))

    # Read in data
    conn <- textConnection(gsub('\\\\n', '\n', req$postBody))
    data <- read.csv(conn)
    close(conn)

    # Convert input to model matrix
    scoring_X <- model.matrix(~., data, xlev=factor_levels)

    ####
    SAVE OBJECT IN S3
    #####


    # Return prediction
    return(paste(predict(mars_model, scoring_X, row.names=FALSE), collapse=','))}

我怎样才能做到这一点?使用 aws.s3 连接到容器还是使用其他技术?

编辑:直接在容器内连接的 aws.s3 解决方案似乎不起作用

4

0 回答 0