Custom Hyperparameters to SageMaker PyTorchModel Inference?

0

Hello,

Is it possible to pass hyperparameters to a PyTorchModel? For instance, in my training script, I would like to load data from the training bucket for use in inference. How would I provide the S3 URI to the inference script from the Estimator and how would it be accessed from within the inference script? Right now I am trying everything from within a SageMaker Notebook Instance. Thanks for any help!

In my notebook I have:

from sagemaker.pytorch.model import PyTorchModel
model_bucket = .......
pytorch_model = PyTorchModel(
    model_data= model_bucket, 
    role=role,                               
    entry_point='inference.py', 
    py_version="py39",
    framework_version="1.13",
)

My inference.py holds:

def model_fn(model_dir):
    pass
def input_fn(request_body, request_content_type):
    pass
def predict_fn(input_data, model):
    pass
def output_fn(prediction, content_type):
    pass
Samuel
已提問 1 年前檢視次數 44 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南