概念
Training jobs, script mode and ML libraries
Bring your own training script to an AWS framework container: you write the model code and SageMaker AI runs the job.
本课尚未翻译,暂以英文显示。
Built-in algorithm
- You bring
- Data and hyperparameters
- Pick when
- An algorithm in the list fits
Script mode
- You bring
- A training script
- Pick when
- Your own model code, common framework
Own container
- You bring
- The whole image
- Pick when
- Special libraries or runtime
| Option | You bring | Pick when |
|---|---|---|
| Built-in algorithm | Data and hyperparameters | An algorithm in the list fits |
| Script mode | A training script | Your own model code, common framework |
| Own container | The whole image | Special libraries or runtime |
是什么
A SageMaker AI training job runs a container on instances you name. You define it with the SageMaker Python SDK, using an estimator (SDK v2, still common on the exam) or ModelTrainer (the single class that replaces the estimators in SDK v3): the instance type and count, the container or framework version, hyperparameters, input data channels in Amazon S3 and an output location. SageMaker AI starts the instances, runs the training code, uploads the model to S3 and stops the instances, so you pay only while the job runs.
是什么
You have three ways to supply the algorithm. Built-in algorithms: AWS supplies the code and you supply data and hyperparameters. Script mode: AWS supplies a prebuilt framework container (scikit-learn, TensorFlow, PyTorch, Hugging Face, XGBoost and others) and you supply your own training script as the entry point. Bring your own container: you supply the whole image, for a library or setup no AWS container has.
是什么
Your script finds what it needs through environment variables and fixed paths. Hyperparameters arrive as command-line arguments, and as SM_HP_ variables. SM_CHANNEL_ followed by the channel name in capitals, such as SM_CHANNEL_TRAIN, is the folder with that input channel. SM_MODEL_DIR is where to save the model: whatever you save there is packed as model.tar.gz and uploaded to S3. SM_OUTPUT_DATA_DIR is for other output files, and SM_NUM_GPUS tells you how many GPUs the instance has.
是什么
Script mode keeps your code close to a laptop script while AWS handles the container, scaling and logs. Choose it over built-in algorithms when you need a custom model or library, and over your own container when a framework container is enough.
要记住
- A training job is instances, a container, data channels, hyperparameters and an S3 output.
- Script mode: your script in an AWS framework container.
- Built-in: AWS supplies the code. Bring your own container: you supply the image.
- Read data from SM_CHANNEL_<NAME>. Write the model to SM_MODEL_DIR.
要记住
- Hyperparameters arrive as arguments and as SM_HP_ variables.
- You pay for the time the job runs.
考试中
- “Run existing PyTorch code with few changes on managed GPU instances” points to script mode with the PyTorch framework container.
- “A library that is in no AWS container” points to bring your own container.
- “Model files must end up in S3” points to saving them to SM_MODEL_DIR.
本任务内容 · 2.2
- Built-in algorithms for tabular data
- Built-in algorithms: clustering, dimensionality reduction, anomaly
- Built-in algorithms: text, sequence and forecasting
- Built-in algorithms: image and video
- Training jobs, script mode and ML libraries
SageMaker AMT
- Reducing training time
- Distributed training and HyperPod
- Overfitting, underfitting and catastrophic forgetting
- Combining models
- Epochs, steps, batch size and learning rate
- Task-specific prompt engineering
- Fine-tuning and continued pre-training in Bedrock
- PEFT, LoRA and fine-tuning on SageMaker
- Model distillation
- Optimizing retrieval and embedding models