모델 컴파일(Amazon SageMaker AI SDK) - Amazon SageMaker AI

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

모델 컴파일(Amazon SageMaker AI SDK)

Amazon SageMaker AI SDK for Pythoncompile_model API를 사용하여 훈련된 모델을 컴파일하고 특정 대상 하드웨어에 맞게 최적화할 수 있습니다. 모델 훈련 중에 사용되는 예측기 객체에서 API를 호출해야 합니다.

참고

MXNet 또는 PyTorch로 모델을 컴파일할 때는 MMS_DEFAULT_RESPONSE_TIMEOUT 환경 변수를 500으로 설정해야 합니다. TensorFlow에는 환경 변수가 필요하지 않습니다.

다음은 trained_model_estimator 객체를 사용하여 모델을 컴파일하는 방법의 예시입니다.

# Replace the value of expected_trained_model_input below and # specify the name & shape of the expected inputs for your trained model # in json dictionary form expected_trained_model_input = {'data':[1, 784]} # Replace the example target_instance_family below to your preferred target_instance_family compiled_model = trained_model_estimator.compile_model(target_instance_family='ml_c5', input_shape=expected_trained_model_input, output_path='insert s3 output path', env={'MMS_DEFAULT_RESPONSE_TIMEOUT': '500'})

이 코드는 모델을 컴파일하고, 최적화된 모델을에 저장하고output_path, 엔드포인트에 배포할 수 있는 SageMaker AI 모델을 생성합니다. Python용 SDK 사용에 대한 샘플 노트북은 Neo 모델 컴파일 샘플 노트북 섹션에서 제공됩니다.