[ aws . sagemakertrainingsessionruntime ]

execute-training-operation

Description

Submits an asynchronous training operation to the specified training session. The service executes operations in sequence number order. The session must be in Running or Blocked state. Use GetTrainingOperationResult to poll for the result. Supported operation types: forward , forwardBackward , optimizerStep , saveWeights , saveState , and loadState .

See also: AWS API Documentation

execute-training-operation uses document type values. Document types follow the JSON data model where valid values are: strings, numbers, booleans, null, arrays, and objects. For command input, options and nested parameters that are labeled with the type document must be provided as JSON. Shorthand syntax does not support document types.

Synopsis

  execute-training-operation
--training-session-name <value>
--sequence-number <value>
[--client-token <value>]
--operation-config <value>
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]
[--cli-error-format <value>]

Options

--training-session-name (string) [required]

The name of the training session to submit the operation to.

Constraints:

  • min: 1
  • max: 64
  • pattern: [a-zA-Z0-9-]+

--sequence-number (integer) [required]

The monotonically increasing sequence number that determines execution order. The training session processes operations strictly in sequence number order. If a gap exists, the session blocks until the missing operation arrives or times out. Must be at least 1.

Constraints:

  • min: 1

--client-token (string)

A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service ignores the request but does not return an error.

Constraints:

  • min: 1
  • max: 128
  • pattern: [a-zA-Z0-9-]+

--operation-config (tagged union structure) [required]

The configuration that specifies the type and parameters of the training operation. Exactly one member of the union must be set.

Note

This is a Tagged Union structure. Only one of the following top level keys can be set: forward, forwardBackward, optimizerStep, saveWeights, saveState, loadState.

forward -> (structure)

The configuration for a forward-only pass through the model without gradient computation.

lossFnName -> (string) [required]

The name of the loss function to evaluate during the forward pass.

Possible values:

  • cross_entropy
  • importance_sampling
  • ppo
  • cispo

datumList -> (list) [required]

The list of input data to feed through the model. Must contain at least one datum, and each datum must have a non-empty modelInput with at least one chunk.

(structure)

A single training datum containing model input and optional loss function inputs.

modelInput -> (structure) [required]

The tokenized input to feed to the model.

chunks -> (list) [required]

The ordered list of encoded text chunks forming the input sequence.

(structure)

A chunk of pre-tokenized text represented as a list of token IDs.

tokens -> (list) [required]

The token IDs representing the encoded text.

(integer)

type -> (string) [required]

The type of the chunk encoding.

Possible values:

  • encoded_text

lossFnInputs -> (map)

The tensor inputs for the loss function, keyed by name. Unsupported keys are rejected. Supported keys: target_tokens , weights , advantages , logprobs , ref_log_prob , temperature . Required keys depend on the loss function type: SFT (cross_entropy ) requires target_tokens and weights ; RL (ppo , cispo , importance_sampling ) requires target_tokens , weights , advantages , and logprobs .

key -> (string)

value -> (structure)

A tensor with data, data type, and shape metadata.

data -> (document) [required]

The raw tensor data as JSON. The format is determined by the dtype field: integer arrays for int64 , floating-point arrays for float32 .

dtype -> (string) [required]

The data type of the tensor elements, such as int64 or float32 .

shape -> (list)

The dimensions of the tensor, such as [batch_size, seq_length].

(integer)

lossFnConfig -> (document)

Additional loss function configuration passed to the engine. Supported keys are clip_low_threshold (valid range: 0 to 1) and clip_high_threshold (valid range: 1 to 10). Unsupported keys are rejected.

forwardBackward -> (structure)

The configuration for a forward and backward pass that computes gradients.

lossFnName -> (string) [required]

The name of the loss function to evaluate during the forward-backward pass.

Possible values:

  • cross_entropy
  • importance_sampling
  • ppo
  • cispo

datumList -> (list) [required]

The list of input data to feed through the model. Must contain at least one datum, and each datum must have a non-empty modelInput with at least one chunk.

(structure)

A single training datum containing model input and optional loss function inputs.

modelInput -> (structure) [required]

The tokenized input to feed to the model.

chunks -> (list) [required]

The ordered list of encoded text chunks forming the input sequence.

(structure)

A chunk of pre-tokenized text represented as a list of token IDs.

tokens -> (list) [required]

The token IDs representing the encoded text.

(integer)

type -> (string) [required]

The type of the chunk encoding.

Possible values:

  • encoded_text

lossFnInputs -> (map)

The tensor inputs for the loss function, keyed by name. Unsupported keys are rejected. Supported keys: target_tokens , weights , advantages , logprobs , ref_log_prob , temperature . Required keys depend on the loss function type: SFT (cross_entropy ) requires target_tokens and weights ; RL (ppo , cispo , importance_sampling ) requires target_tokens , weights , advantages , and logprobs .

key -> (string)

value -> (structure)

A tensor with data, data type, and shape metadata.

data -> (document) [required]

The raw tensor data as JSON. The format is determined by the dtype field: integer arrays for int64 , floating-point arrays for float32 .

dtype -> (string) [required]

The data type of the tensor elements, such as int64 or float32 .

shape -> (list)

The dimensions of the tensor, such as [batch_size, seq_length].

(integer)

lossFnConfig -> (document)

Additional loss function configuration passed to the engine. Supported keys are clip_low_threshold (valid range: 0 to 1) and clip_high_threshold (valid range: 1 to 10). Unsupported keys are rejected.

optimizerStep -> (structure)

The configuration for an optimizer step that updates model weights using accumulated gradients.

adamParamsConfig -> (structure) [required]

The Adam optimizer hyperparameters for this step.

learningRate -> (double) [required]

The learning rate for the optimizer. Must be greater than 0.

Constraints:

  • min: 0
  • max: 0.01

beta1 -> (double)

The exponential decay rate for the first moment estimates.

Constraints:

  • min: 0
  • max: 0.999999

beta2 -> (double)

The exponential decay rate for the second moment estimates.

Constraints:

  • min: 0
  • max: 0.999999

eps -> (double)

A small constant added to the denominator for numerical stability.

Constraints:

  • min: 1e-16
  • max: 0.01

weightDecay -> (double)

The weight decay (L2 regularization) coefficient.

Constraints:

  • min: 0
  • max: 1

gradClipNorm -> (double)

The maximum gradient norm for gradient clipping. Gradients are scaled down if their norm exceeds this value.

Constraints:

  • min: 0
  • max: 100

loraPlusLrRatio -> (double)

The learning rate multiplier for LoRA+ B matrices relative to A matrices. When set, B matrices use learningRate * loraPlusLrRatio while A matrices use the base learning rate.

Constraints:

  • min: 1.0
  • max: 100.0

saveWeights -> (structure)

The configuration for saving model weights as a checkpoint.

mergeWeights -> (boolean)

Specifies whether to merge LoRA adapter weights into the base model before saving. When true, the saved checkpoint contains the full merged model weights.

description -> (string)

A human-readable description for the saved checkpoint.

Constraints:

  • min: 0
  • max: 1024

saveState -> (structure)

The configuration for saving full training state, including model weights and optimizer state.

description -> (string)

A human-readable description for the saved state checkpoint.

Constraints:

  • min: 0
  • max: 1024

loadState -> (structure)

The configuration for loading training state from a previously saved checkpoint.

modelPackageArn -> (string) [required]

The ARN of the model package containing the checkpoint to load. Must be a valid SageMaker model package ARN in the format arn:aws:sagemaker:REGION:ACCOUNT:model-package/PACKAGE_NAME/VERSION . Model package group ARNs are not accepted.

loadOptimizer -> (boolean) [required]

Specifies whether to also restore the optimizer state alongside model weights. When true, optimizer state is restored to resume training from where it left off.

JSON Syntax:

{
  "forward": {
    "lossFnName": "cross_entropy"|"importance_sampling"|"ppo"|"cispo",
    "datumList": [
      {
        "modelInput": {
          "chunks": [
            {
              "tokens": [integer, ...],
              "type": "encoded_text"
            }
            ...
          ]
        },
        "lossFnInputs": {"string": {
              "data": {...},
              "dtype": "string",
              "shape": [integer, ...]
            }
          ...}
      }
      ...
    ],
    "lossFnConfig": {...}
  },
  "forwardBackward": {
    "lossFnName": "cross_entropy"|"importance_sampling"|"ppo"|"cispo",
    "datumList": [
      {
        "modelInput": {
          "chunks": [
            {
              "tokens": [integer, ...],
              "type": "encoded_text"
            }
            ...
          ]
        },
        "lossFnInputs": {"string": {
              "data": {...},
              "dtype": "string",
              "shape": [integer, ...]
            }
          ...}
      }
      ...
    ],
    "lossFnConfig": {...}
  },
  "optimizerStep": {
    "adamParamsConfig": {
      "learningRate": double,
      "beta1": double,
      "beta2": double,
      "eps": double,
      "weightDecay": double,
      "gradClipNorm": double,
      "loraPlusLrRatio": double
    }
  },
  "saveWeights": {
    "mergeWeights": true|false,
    "description": "string"
  },
  "saveState": {
    "description": "string"
  },
  "loadState": {
    "modelPackageArn": "string",
    "loadOptimizer": true|false
  }
}

--cli-input-json | --cli-input-yaml (string) Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command. The generated JSON skeleton is not stable between versions of the AWS CLI and there are no backwards compatibility guarantees in the JSON skeleton generated.

Global Options

--debug (boolean)

Turn on debug logging.

--endpoint-url (string)

Override command’s default URL with the given URL.

--no-verify-ssl (boolean)

By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.

--no-paginate (boolean)

Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.

--output (string)

The formatting style for command output.

  • json
  • text
  • table
  • yaml
  • yaml-stream
  • off

--query (string)

A JMESPath query to use in filtering the response data.

--profile (string)

Use a specific profile from your credential file.

--region (string)

The region to use. Overrides config/env settings.

--version (string)

Display the version of this tool.

--color (string)

Turn on/off color output.

  • on
  • off
  • auto

--no-sign-request (boolean)

Do not sign requests. Credentials will not be loaded if this argument is provided.

--ca-bundle (string)

The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.

--cli-read-timeout (int)

The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.

--cli-connect-timeout (int)

The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.

--cli-binary-format (string)

The formatting style to be used for binary blobs. The default format is base64. The base64 format expects binary blobs to be provided as a base64 encoded string. The raw-in-base64-out format preserves compatibility with AWS CLI V1 behavior and binary values must be passed literally. When providing contents from a file that map to a binary blob fileb:// will always be treated as binary and use the file contents directly regardless of the cli-binary-format setting. When using file:// the file contents will need to properly formatted for the configured cli-binary-format.

  • base64
  • raw-in-base64-out

--no-cli-pager (boolean)

Disable cli pager for output.

--cli-auto-prompt (boolean)

Automatically prompt for CLI input parameters.

--no-cli-auto-prompt (boolean)

Disable automatically prompt for CLI input parameters.

--cli-error-format (string)

The formatting style for error output. By default, errors are displayed in enhanced format.

  • legacy
  • json
  • yaml
  • text
  • table
  • enhanced

Output

operationId -> (string)

The unique identifier for the submitted operation. Use this identifier with GetTrainingOperationResult to retrieve the operation status and result.

Constraints:

  • min: 1
  • max: 64
  • pattern: [a-zA-Z0-9-]+