

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

# SageMaker Python SDK를 사용하여 데이터 입력 모드 구성
<a name="model-access-training-data-using-pysdk"></a>

SageMaker Python SDK는 훈련 작업을 시작하기 위한 [ML 프레임워크용](https://sagemaker.readthedocs.io/en/stable/frameworks/index.html) 일반 [Estimator(추정기) 클래스와 그 변형](https://sagemaker.readthedocs.io/en/stable/api/training/estimators.html#sagemaker.estimator.Estimator)을 제공합니다. SageMaker AI `Estimator` 클래스 또는 `Estimator.fit` 메서드를 구성하면서 데이터 입력 모드 중 하나를 지정할 수 있습니다. 다음 코드 템플릿은 입력 모드를 지정하는 두 가지 방법을 보여줍니다.

**Estimator 클래스를 사용하여 입력 모드를 지정하려면**

```
from sagemaker.estimator import Estimator
from sagemaker.inputs import TrainingInput

estimator = Estimator(
    checkpoint_s3_uri='s3://amzn-s3-demo-bucket/checkpoint-destination/',
    output_path='s3://amzn-s3-demo-bucket/output-path/',
    base_job_name='job-name',
    input_mode='File'  # Available options: File | Pipe | FastFile
    ...
)

# Run the training job
estimator.fit(
    inputs=TrainingInput(s3_data="s3://amzn-s3-demo-bucket/my-data/train")
)
```

자세한 내용은 *SageMaker Python SDK 설명서*의 [SageMaker.Estimator.Estimator](https://sagemaker.readthedocs.io/en/stable/api/training/estimators.html#sagemaker.estimator.Estimator) 클래스를 참조하세요.

**`estimator.fit()` 메서드를 통해 입력 모드를 지정하려면**

```
from sagemaker.estimator import Estimator
from sagemaker.inputs import TrainingInput

estimator = Estimator(
    checkpoint_s3_uri='s3://amzn-s3-demo-bucket/checkpoint-destination/',
    output_path='s3://amzn-s3-demo-bucket/output-path/',
    base_job_name='job-name',
    ...
)

# Run the training job
estimator.fit(
    inputs=TrainingInput(
        s3_data="s3://amzn-s3-demo-bucket/my-data/train",
        input_mode='File'  # Available options: File | Pipe | FastFile
    )
)
```

자세한 내용은 *SageMaker Python SDK 설명서*의 [sagemaker.estimator.Estimator.fit](https://sagemaker.readthedocs.io/en/stable/api/training/estimators.html#sagemaker.estimator.Estimator.fit) 클래스 메서드와 [sagemaker.inputs.TrainingInput](https://sagemaker.readthedocs.io/en/stable/api/utility/inputs.html#sagemaker.inputs.TrainingInput) 클래스를 참조하세요.

**작은 정보**  
SageMaker Python SDK 예측기를 사용하여 VPC 구성으로 Amazon FSx for Lustre 또는 Amazon EFS를 구성하는 방법에 대해 자세히 알아보려면 *SageMaker AI Python SDK 설명서*에 나와 있는 [Use File Systems as Training Inputs](https://sagemaker.readthedocs.io/en/stable/overview.html?highlight=VPC#use-file-systems-as-training-inputs)를 참조하세요.

**작은 정보**  
Amazon S3, Amazon EFS 및 FSx for Lustre와의 데이터 입력 모드 통합은 모범 사례에 맞게 데이터 소스를 최적으로 구성하기 위한 권장 방법입니다. SageMaker AI의 관리형 스토리지 옵션 및 입력 모드를 사용하여 데이터 로드 성능을 전략적으로 개선할 수 있지만 엄격하게 제한되지 않습니다. 훈련 컨테이너에 직접 데이터 읽기 로직을 작성할 수 있습니다. 예를 들어, 다른 데이터 소스에서 읽거나, 자체 S3 데이터 로더 클래스를 작성하거나, 훈련 스크립트 내에서 타사 프레임워크의 데이터 로드 함수를 사용하도록 설정할 수 있습니다. 하지만 SageMaker AI가 인식할 수 있는 올바른 경로를 지정했는지 확인해야 합니다.

**작은 정보**  
사용자 지정 훈련 컨테이너를 사용하는 경우 SageMaker 훈련 작업을 위한 환경을 설정하는 데 도움이 되는 [SageMaker 훈련 도구 키트](https://github.com/aws/sagemaker-training-toolkit)를 설치해야 합니다. 그렇지 않으면 Dockerfile에서 환경 변수를 명시적으로 지정해야 합니다. 자세한 정보는 [자체 알고리즘과 모델을 사용하여 컨테이너 생성](https://docs.aws.amazon.com/sagemaker/latest/dg/docker-containers-create.html)을 참조하세요.

하위 수준 SageMaker API를 사용하여 데이터 입력 모드를 설정하는 방법에 대한 자세한 내용은 [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_AlgorithmSpecification.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_AlgorithmSpecification.html)의 [Amazon SageMaker AI의 훈련 정보 제공 방법](your-algorithms-training-algo-running-container.md), [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTrainingJob.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTrainingJob.html)API 및 `TrainingInputMode`을/를 참조하세요.