Interface SageMakerTrainingSessionRuntimeClient
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
builder() method.
Amazon SageMaker Training Session Runtime provides APIs for executing training operations and sampling operations against a running training session. Use these APIs to submit asynchronous training steps (such as forward-backward passes, optimizer steps, and checkpoint saves) and to generate text samples from the model being trained.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValue for looking up the service's metadata from theServiceMetadataProvider.static final String -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a builder that can be used to configure and create aSageMakerTrainingSessionRuntimeClient.create()Create aSageMakerTrainingSessionRuntimeClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.default ExecuteSamplingOperationResponseexecuteSamplingOperation(Consumer<ExecuteSamplingOperationRequest.Builder> executeSamplingOperationRequest) Submits an asynchronous sampling operation to generate text or compute log-probabilities from the model associated with the specified training session.default ExecuteSamplingOperationResponseexecuteSamplingOperation(ExecuteSamplingOperationRequest executeSamplingOperationRequest) Submits an asynchronous sampling operation to generate text or compute log-probabilities from the model associated with the specified training session.default ExecuteTrainingOperationResponseexecuteTrainingOperation(Consumer<ExecuteTrainingOperationRequest.Builder> executeTrainingOperationRequest) Submits an asynchronous training operation to the specified training session.default ExecuteTrainingOperationResponseexecuteTrainingOperation(ExecuteTrainingOperationRequest executeTrainingOperationRequest) Submits an asynchronous training operation to the specified training session.getSamplingOperationResult(Consumer<GetSamplingOperationResultRequest.Builder> getSamplingOperationResultRequest) Retrieves the current status and result of a previously submitted sampling operation.getSamplingOperationResult(GetSamplingOperationResultRequest getSamplingOperationResultRequest) Retrieves the current status and result of a previously submitted sampling operation.getTrainingOperationResult(Consumer<GetTrainingOperationResultRequest.Builder> getTrainingOperationResultRequest) Retrieves the current status and result of a previously submitted training operation.getTrainingOperationResult(GetTrainingOperationResultRequest getTrainingOperationResultRequest) Retrieves the current status and result of a previously submitted training operation.default SampleTrainingSessionResponsesampleTrainingSession(Consumer<SampleTrainingSessionRequest.Builder> sampleTrainingSessionRequest) Sends an inference request to the model associated with the specified training session and returns the response synchronously.default SampleTrainingSessionResponsesampleTrainingSession(SampleTrainingSessionRequest sampleTrainingSessionRequest) Sends an inference request to the model associated with the specified training session and returns the response synchronously.sampleTrainingSessionWithResponseStream(Consumer<SampleTrainingSessionWithResponseStreamRequest.Builder> sampleTrainingSessionWithResponseStreamRequest) Streams inference responses from the model associated with the specified training session.sampleTrainingSessionWithResponseStream(Consumer<SampleTrainingSessionWithResponseStreamRequest.Builder> sampleTrainingSessionWithResponseStreamRequest, Path destinationPath) Streams inference responses from the model associated with the specified training session.default <ReturnT> ReturnTsampleTrainingSessionWithResponseStream(Consumer<SampleTrainingSessionWithResponseStreamRequest.Builder> sampleTrainingSessionWithResponseStreamRequest, ResponseTransformer<SampleTrainingSessionWithResponseStreamResponse, ReturnT> responseTransformer) Streams inference responses from the model associated with the specified training session.sampleTrainingSessionWithResponseStream(SampleTrainingSessionWithResponseStreamRequest sampleTrainingSessionWithResponseStreamRequest) Streams inference responses from the model associated with the specified training session.sampleTrainingSessionWithResponseStream(SampleTrainingSessionWithResponseStreamRequest sampleTrainingSessionWithResponseStreamRequest, Path destinationPath) Streams inference responses from the model associated with the specified training session.default <ReturnT> ReturnTsampleTrainingSessionWithResponseStream(SampleTrainingSessionWithResponseStreamRequest sampleTrainingSessionWithResponseStreamRequest, ResponseTransformer<SampleTrainingSessionWithResponseStreamResponse, ReturnT> responseTransformer) Streams inference responses from the model associated with the specified training session.sampleTrainingSessionWithResponseStreamAsBytes(Consumer<SampleTrainingSessionWithResponseStreamRequest.Builder> sampleTrainingSessionWithResponseStreamRequest) Streams inference responses from the model associated with the specified training session.sampleTrainingSessionWithResponseStreamAsBytes(SampleTrainingSessionWithResponseStreamRequest sampleTrainingSessionWithResponseStreamRequest) Streams inference responses from the model associated with the specified training session.The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfigurationstatic ServiceMetadataMethods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
closeMethods inherited from interface software.amazon.awssdk.core.SdkClient
serviceName
-
Field Details
-
SERVICE_NAME
- See Also:
-
SERVICE_METADATA_ID
Value for looking up the service's metadata from theServiceMetadataProvider.- See Also:
-
-
Method Details
-
executeSamplingOperation
default ExecuteSamplingOperationResponse executeSamplingOperation(ExecuteSamplingOperationRequest executeSamplingOperationRequest) throws ConflictException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Submits an asynchronous sampling operation to generate text or compute log-probabilities from the model associated with the specified training session. The session must be in
RunningorBlockedstate. UseGetSamplingOperationResultto poll for the result.- Parameters:
executeSamplingOperationRequest-- Returns:
- Result of the ExecuteSamplingOperation operation returned by the service.
- See Also:
-
executeSamplingOperation
default ExecuteSamplingOperationResponse executeSamplingOperation(Consumer<ExecuteSamplingOperationRequest.Builder> executeSamplingOperationRequest) throws ConflictException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Submits an asynchronous sampling operation to generate text or compute log-probabilities from the model associated with the specified training session. The session must be in
RunningorBlockedstate. UseGetSamplingOperationResultto poll for the result.
This is a convenience which creates an instance of the
ExecuteSamplingOperationRequest.Builderavoiding the need to create one manually viaExecuteSamplingOperationRequest.builder()- Parameters:
executeSamplingOperationRequest- AConsumerthat will call methods onExecuteSamplingOperationRequest.Builderto create a request.- Returns:
- Result of the ExecuteSamplingOperation operation returned by the service.
- See Also:
-
executeTrainingOperation
default ExecuteTrainingOperationResponse executeTrainingOperation(ExecuteTrainingOperationRequest executeTrainingOperationRequest) throws ConflictException, ThrottlingException, ResourceNotFoundException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Submits an asynchronous training operation to the specified training session. The service executes operations in sequence number order. The session must be in
RunningorBlockedstate. UseGetTrainingOperationResultto poll for the result. Supported operation types:forward,forwardBackward,optimizerStep,saveWeights,saveState, andloadState.- Parameters:
executeTrainingOperationRequest-- Returns:
- Result of the ExecuteTrainingOperation operation returned by the service.
- See Also:
-
executeTrainingOperation
default ExecuteTrainingOperationResponse executeTrainingOperation(Consumer<ExecuteTrainingOperationRequest.Builder> executeTrainingOperationRequest) throws ConflictException, ThrottlingException, ResourceNotFoundException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Submits an asynchronous training operation to the specified training session. The service executes operations in sequence number order. The session must be in
RunningorBlockedstate. UseGetTrainingOperationResultto poll for the result. Supported operation types:forward,forwardBackward,optimizerStep,saveWeights,saveState, andloadState.
This is a convenience which creates an instance of the
ExecuteTrainingOperationRequest.Builderavoiding the need to create one manually viaExecuteTrainingOperationRequest.builder()- Parameters:
executeTrainingOperationRequest- AConsumerthat will call methods onExecuteTrainingOperationRequest.Builderto create a request.- Returns:
- Result of the ExecuteTrainingOperation operation returned by the service.
- See Also:
-
getSamplingOperationResult
default GetSamplingOperationResultResponse getSamplingOperationResult(GetSamplingOperationResultRequest getSamplingOperationResultRequest) throws ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Retrieves the current status and result of a previously submitted sampling operation. Poll this operation until the status reaches a terminal state (Completed or Failed).
- Parameters:
getSamplingOperationResultRequest-- Returns:
- Result of the GetSamplingOperationResult operation returned by the service.
- See Also:
-
getSamplingOperationResult
default GetSamplingOperationResultResponse getSamplingOperationResult(Consumer<GetSamplingOperationResultRequest.Builder> getSamplingOperationResultRequest) throws ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Retrieves the current status and result of a previously submitted sampling operation. Poll this operation until the status reaches a terminal state (Completed or Failed).
This is a convenience which creates an instance of the
GetSamplingOperationResultRequest.Builderavoiding the need to create one manually viaGetSamplingOperationResultRequest.builder()- Parameters:
getSamplingOperationResultRequest- AConsumerthat will call methods onGetSamplingOperationResultRequest.Builderto create a request.- Returns:
- Result of the GetSamplingOperationResult operation returned by the service.
- See Also:
-
getTrainingOperationResult
default GetTrainingOperationResultResponse getTrainingOperationResult(GetTrainingOperationResultRequest getTrainingOperationResultRequest) throws ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Retrieves the current status and result of a previously submitted training operation. Poll this operation until the status reaches a terminal state (Completed, Failed, or Skipped).
- Parameters:
getTrainingOperationResultRequest-- Returns:
- Result of the GetTrainingOperationResult operation returned by the service.
- See Also:
-
getTrainingOperationResult
default GetTrainingOperationResultResponse getTrainingOperationResult(Consumer<GetTrainingOperationResultRequest.Builder> getTrainingOperationResultRequest) throws ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Retrieves the current status and result of a previously submitted training operation. Poll this operation until the status reaches a terminal state (Completed, Failed, or Skipped).
This is a convenience which creates an instance of the
GetTrainingOperationResultRequest.Builderavoiding the need to create one manually viaGetTrainingOperationResultRequest.builder()- Parameters:
getTrainingOperationResultRequest- AConsumerthat will call methods onGetTrainingOperationResultRequest.Builderto create a request.- Returns:
- Result of the GetTrainingOperationResult operation returned by the service.
- See Also:
-
sampleTrainingSession
default SampleTrainingSessionResponse sampleTrainingSession(SampleTrainingSessionRequest sampleTrainingSessionRequest) throws ConflictException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Sends an inference request to the model associated with the specified training session and returns the response synchronously. The service passes the request and response bodies to and from the model without modification.
- Parameters:
sampleTrainingSessionRequest-- Returns:
- Result of the SampleTrainingSession operation returned by the service.
- See Also:
-
sampleTrainingSession
default SampleTrainingSessionResponse sampleTrainingSession(Consumer<SampleTrainingSessionRequest.Builder> sampleTrainingSessionRequest) throws ConflictException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Sends an inference request to the model associated with the specified training session and returns the response synchronously. The service passes the request and response bodies to and from the model without modification.
This is a convenience which creates an instance of the
SampleTrainingSessionRequest.Builderavoiding the need to create one manually viaSampleTrainingSessionRequest.builder()- Parameters:
sampleTrainingSessionRequest- AConsumerthat will call methods onSampleTrainingSessionRequest.Builderto create a request.- Returns:
- Result of the SampleTrainingSession operation returned by the service.
- See Also:
-
sampleTrainingSessionWithResponseStream
default <ReturnT> ReturnT sampleTrainingSessionWithResponseStream(SampleTrainingSessionWithResponseStreamRequest sampleTrainingSessionWithResponseStreamRequest, ResponseTransformer<SampleTrainingSessionWithResponseStreamResponse, ReturnT> responseTransformer) throws ConflictException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeExceptionStreams inference responses from the model associated with the specified training session. Use this operation for real-time token-by-token generation. The service passes the request body to the model without modification.
- Parameters:
sampleTrainingSessionWithResponseStreamRequest-responseTransformer- Functional interface for processing the streamed response content. The unmarshalled SampleTrainingSessionWithResponseStreamResponse and an InputStream to the response content are provided as parameters to the callback. The callback may return a transformed type which will be the return value of this method. SeeResponseTransformerfor details on implementing this interface and for links to pre-canned implementations for common scenarios like downloading to a file. The service documentation for the response content is as follows 'The streaming inference response from the model, delivered as a series of chunks.
'.- Returns:
- The transformed result of the ResponseTransformer.
- See Also:
-
sampleTrainingSessionWithResponseStream
default <ReturnT> ReturnT sampleTrainingSessionWithResponseStream(Consumer<SampleTrainingSessionWithResponseStreamRequest.Builder> sampleTrainingSessionWithResponseStreamRequest, ResponseTransformer<SampleTrainingSessionWithResponseStreamResponse, ReturnT> responseTransformer) throws ConflictException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeExceptionStreams inference responses from the model associated with the specified training session. Use this operation for real-time token-by-token generation. The service passes the request body to the model without modification.
This is a convenience which creates an instance of the
SampleTrainingSessionWithResponseStreamRequest.Builderavoiding the need to create one manually viaSampleTrainingSessionWithResponseStreamRequest.builder()- Parameters:
sampleTrainingSessionWithResponseStreamRequest- AConsumerthat will call methods onSampleTrainingSessionWithResponseStreamRequest.Builderto create a request.responseTransformer- Functional interface for processing the streamed response content. The unmarshalled SampleTrainingSessionWithResponseStreamResponse and an InputStream to the response content are provided as parameters to the callback. The callback may return a transformed type which will be the return value of this method. SeeResponseTransformerfor details on implementing this interface and for links to pre-canned implementations for common scenarios like downloading to a file. The service documentation for the response content is as follows 'The streaming inference response from the model, delivered as a series of chunks.
'.- Returns:
- The transformed result of the ResponseTransformer.
- See Also:
-
sampleTrainingSessionWithResponseStream
default SampleTrainingSessionWithResponseStreamResponse sampleTrainingSessionWithResponseStream(SampleTrainingSessionWithResponseStreamRequest sampleTrainingSessionWithResponseStreamRequest, Path destinationPath) throws ConflictException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Streams inference responses from the model associated with the specified training session. Use this operation for real-time token-by-token generation. The service passes the request body to the model without modification.
- Parameters:
sampleTrainingSessionWithResponseStreamRequest-destinationPath-Pathto file that response contents will be written to. The file must not exist or this method will throw an exception. If the file is not writable by the current user then an exception will be thrown. The service documentation for the response content is as follows 'The streaming inference response from the model, delivered as a series of chunks.
'.- Returns:
- The transformed result of the ResponseTransformer.
- See Also:
-
sampleTrainingSessionWithResponseStream
default SampleTrainingSessionWithResponseStreamResponse sampleTrainingSessionWithResponseStream(Consumer<SampleTrainingSessionWithResponseStreamRequest.Builder> sampleTrainingSessionWithResponseStreamRequest, Path destinationPath) throws ConflictException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Streams inference responses from the model associated with the specified training session. Use this operation for real-time token-by-token generation. The service passes the request body to the model without modification.
This is a convenience which creates an instance of the
SampleTrainingSessionWithResponseStreamRequest.Builderavoiding the need to create one manually viaSampleTrainingSessionWithResponseStreamRequest.builder()- Parameters:
sampleTrainingSessionWithResponseStreamRequest- AConsumerthat will call methods onSampleTrainingSessionWithResponseStreamRequest.Builderto create a request.destinationPath-Pathto file that response contents will be written to. The file must not exist or this method will throw an exception. If the file is not writable by the current user then an exception will be thrown. The service documentation for the response content is as follows 'The streaming inference response from the model, delivered as a series of chunks.
'.- Returns:
- The transformed result of the ResponseTransformer.
- See Also:
-
sampleTrainingSessionWithResponseStream
default ResponseInputStream<SampleTrainingSessionWithResponseStreamResponse> sampleTrainingSessionWithResponseStream(SampleTrainingSessionWithResponseStreamRequest sampleTrainingSessionWithResponseStreamRequest) throws ConflictException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Streams inference responses from the model associated with the specified training session. Use this operation for real-time token-by-token generation. The service passes the request body to the model without modification.
- Parameters:
sampleTrainingSessionWithResponseStreamRequest-- Returns:
- A
ResponseInputStreamcontaining data streamed from service. Note that this is an unmanaged reference to the underlying HTTP connection so great care must be taken to ensure all data if fully read from the input stream and that it is properly closed. Failure to do so may result in sub-optimal behavior and exhausting connections in the connection pool. The unmarshalled response object can be obtained viaResponseInputStream.response(). The service documentation for the response content is as follows 'The streaming inference response from the model, delivered as a series of chunks.
'. - See Also:
-
sampleTrainingSessionWithResponseStream
default ResponseInputStream<SampleTrainingSessionWithResponseStreamResponse> sampleTrainingSessionWithResponseStream(Consumer<SampleTrainingSessionWithResponseStreamRequest.Builder> sampleTrainingSessionWithResponseStreamRequest) throws ConflictException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Streams inference responses from the model associated with the specified training session. Use this operation for real-time token-by-token generation. The service passes the request body to the model without modification.
This is a convenience which creates an instance of the
SampleTrainingSessionWithResponseStreamRequest.Builderavoiding the need to create one manually viaSampleTrainingSessionWithResponseStreamRequest.builder()- Parameters:
sampleTrainingSessionWithResponseStreamRequest- AConsumerthat will call methods onSampleTrainingSessionWithResponseStreamRequest.Builderto create a request.- Returns:
- A
ResponseInputStreamcontaining data streamed from service. Note that this is an unmanaged reference to the underlying HTTP connection so great care must be taken to ensure all data if fully read from the input stream and that it is properly closed. Failure to do so may result in sub-optimal behavior and exhausting connections in the connection pool. The unmarshalled response object can be obtained viaResponseInputStream.response(). The service documentation for the response content is as follows 'The streaming inference response from the model, delivered as a series of chunks.
'. - See Also:
-
sampleTrainingSessionWithResponseStreamAsBytes
default ResponseBytes<SampleTrainingSessionWithResponseStreamResponse> sampleTrainingSessionWithResponseStreamAsBytes(SampleTrainingSessionWithResponseStreamRequest sampleTrainingSessionWithResponseStreamRequest) throws ConflictException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Streams inference responses from the model associated with the specified training session. Use this operation for real-time token-by-token generation. The service passes the request body to the model without modification.
- Parameters:
sampleTrainingSessionWithResponseStreamRequest-- Returns:
- A
ResponseBytesthat loads the data streamed from the service into memory and exposes it in convenient in-memory representations like a byte buffer or string. The unmarshalled response object can be obtained viaResponseBytes.response(). The service documentation for the response content is as follows 'The streaming inference response from the model, delivered as a series of chunks.
'. - See Also:
-
sampleTrainingSessionWithResponseStreamAsBytes
default ResponseBytes<SampleTrainingSessionWithResponseStreamResponse> sampleTrainingSessionWithResponseStreamAsBytes(Consumer<SampleTrainingSessionWithResponseStreamRequest.Builder> sampleTrainingSessionWithResponseStreamRequest) throws ConflictException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, SageMakerTrainingSessionRuntimeException Streams inference responses from the model associated with the specified training session. Use this operation for real-time token-by-token generation. The service passes the request body to the model without modification.
This is a convenience which creates an instance of the
SampleTrainingSessionWithResponseStreamRequest.Builderavoiding the need to create one manually viaSampleTrainingSessionWithResponseStreamRequest.builder()- Parameters:
sampleTrainingSessionWithResponseStreamRequest- AConsumerthat will call methods onSampleTrainingSessionWithResponseStreamRequest.Builderto create a request.- Returns:
- A
ResponseBytesthat loads the data streamed from the service into memory and exposes it in convenient in-memory representations like a byte buffer or string. The unmarshalled response object can be obtained viaResponseBytes.response(). The service documentation for the response content is as follows 'The streaming inference response from the model, delivered as a series of chunks.
'. - See Also:
-
create
Create aSageMakerTrainingSessionRuntimeClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider. -
builder
Create a builder that can be used to configure and create aSageMakerTrainingSessionRuntimeClient. -
serviceMetadata
-
serviceClientConfiguration
Description copied from interface:SdkClientThe SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration- Specified by:
serviceClientConfigurationin interfaceAwsClient- Specified by:
serviceClientConfigurationin interfaceSdkClient- Returns:
- SdkServiceClientConfiguration
-