aws-sdk-sagemakertrainingsessionruntime 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +202 -0
- data/VERSION +1 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime/async_client.rb +451 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime/client.rb +1103 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime/client_api.rb +482 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime/customizations.rb +0 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime/endpoint_parameters.rb +59 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime/endpoint_provider.rb +41 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime/endpoints.rb +20 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime/errors.rb +118 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime/plugins/endpoints.rb +77 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime/resource.rb +26 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime/types.rb +1183 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime/waiters.rb +15 -0
- data/lib/aws-sdk-sagemakertrainingsessionruntime.rb +79 -0
- data/sig/async_client.rbs +68 -0
- data/sig/client.rbs +240 -0
- data/sig/errors.rbs +31 -0
- data/sig/params.rbs +30 -0
- data/sig/resource.rbs +85 -0
- data/sig/types.rbs +379 -0
- data/sig/waiters.rbs +13 -0
- metadata +100 -0
|
@@ -0,0 +1,1103 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# WARNING ABOUT GENERATED CODE
|
|
4
|
+
#
|
|
5
|
+
# This file is generated. See the contributing guide for more information:
|
|
6
|
+
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
|
|
7
|
+
#
|
|
8
|
+
# WARNING ABOUT GENERATED CODE
|
|
9
|
+
|
|
10
|
+
require 'seahorse/client/plugins/content_length'
|
|
11
|
+
require 'aws-sdk-core/plugins/credentials_configuration'
|
|
12
|
+
require 'aws-sdk-core/plugins/logging'
|
|
13
|
+
require 'aws-sdk-core/plugins/param_converter'
|
|
14
|
+
require 'aws-sdk-core/plugins/param_validator'
|
|
15
|
+
require 'aws-sdk-core/plugins/user_agent'
|
|
16
|
+
require 'aws-sdk-core/plugins/helpful_socket_errors'
|
|
17
|
+
require 'aws-sdk-core/plugins/retry_errors'
|
|
18
|
+
require 'aws-sdk-core/plugins/global_configuration'
|
|
19
|
+
require 'aws-sdk-core/plugins/regional_endpoint'
|
|
20
|
+
require 'aws-sdk-core/plugins/endpoint_discovery'
|
|
21
|
+
require 'aws-sdk-core/plugins/endpoint_pattern'
|
|
22
|
+
require 'aws-sdk-core/plugins/response_paging'
|
|
23
|
+
require 'aws-sdk-core/plugins/stub_responses'
|
|
24
|
+
require 'aws-sdk-core/plugins/idempotency_token'
|
|
25
|
+
require 'aws-sdk-core/plugins/invocation_id'
|
|
26
|
+
require 'aws-sdk-core/plugins/jsonvalue_converter'
|
|
27
|
+
require 'aws-sdk-core/plugins/client_metrics_plugin'
|
|
28
|
+
require 'aws-sdk-core/plugins/client_metrics_send_plugin'
|
|
29
|
+
require 'aws-sdk-core/plugins/transfer_encoding'
|
|
30
|
+
require 'aws-sdk-core/plugins/http_checksum'
|
|
31
|
+
require 'aws-sdk-core/plugins/checksum_algorithm'
|
|
32
|
+
require 'aws-sdk-core/plugins/request_compression'
|
|
33
|
+
require 'aws-sdk-core/plugins/defaults_mode'
|
|
34
|
+
require 'aws-sdk-core/plugins/recursion_detection'
|
|
35
|
+
require 'aws-sdk-core/plugins/telemetry'
|
|
36
|
+
require 'aws-sdk-core/plugins/sign'
|
|
37
|
+
require 'aws-sdk-core/plugins/protocols/rest_json'
|
|
38
|
+
|
|
39
|
+
module Aws::SageMakerTrainingSessionRuntime
|
|
40
|
+
# An API client for SageMakerTrainingSessionRuntime. To construct a client, you need to configure a `:region` and `:credentials`.
|
|
41
|
+
#
|
|
42
|
+
# client = Aws::SageMakerTrainingSessionRuntime::Client.new(
|
|
43
|
+
# region: region_name,
|
|
44
|
+
# credentials: credentials,
|
|
45
|
+
# # ...
|
|
46
|
+
# )
|
|
47
|
+
#
|
|
48
|
+
# For details on configuring region and credentials see
|
|
49
|
+
# the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
|
|
50
|
+
#
|
|
51
|
+
# See {#initialize} for a full list of supported configuration options.
|
|
52
|
+
class Client < Seahorse::Client::Base
|
|
53
|
+
|
|
54
|
+
include Aws::ClientStubs
|
|
55
|
+
|
|
56
|
+
@identifier = :sagemakertrainingsessionruntime
|
|
57
|
+
|
|
58
|
+
set_api(ClientApi::API)
|
|
59
|
+
|
|
60
|
+
add_plugin(Seahorse::Client::Plugins::ContentLength)
|
|
61
|
+
add_plugin(Aws::Plugins::CredentialsConfiguration)
|
|
62
|
+
add_plugin(Aws::Plugins::Logging)
|
|
63
|
+
add_plugin(Aws::Plugins::ParamConverter)
|
|
64
|
+
add_plugin(Aws::Plugins::ParamValidator)
|
|
65
|
+
add_plugin(Aws::Plugins::UserAgent)
|
|
66
|
+
add_plugin(Aws::Plugins::HelpfulSocketErrors)
|
|
67
|
+
add_plugin(Aws::Plugins::RetryErrors)
|
|
68
|
+
add_plugin(Aws::Plugins::GlobalConfiguration)
|
|
69
|
+
add_plugin(Aws::Plugins::RegionalEndpoint)
|
|
70
|
+
add_plugin(Aws::Plugins::EndpointDiscovery)
|
|
71
|
+
add_plugin(Aws::Plugins::EndpointPattern)
|
|
72
|
+
add_plugin(Aws::Plugins::ResponsePaging)
|
|
73
|
+
add_plugin(Aws::Plugins::StubResponses)
|
|
74
|
+
add_plugin(Aws::Plugins::IdempotencyToken)
|
|
75
|
+
add_plugin(Aws::Plugins::InvocationId)
|
|
76
|
+
add_plugin(Aws::Plugins::JsonvalueConverter)
|
|
77
|
+
add_plugin(Aws::Plugins::ClientMetricsPlugin)
|
|
78
|
+
add_plugin(Aws::Plugins::ClientMetricsSendPlugin)
|
|
79
|
+
add_plugin(Aws::Plugins::TransferEncoding)
|
|
80
|
+
add_plugin(Aws::Plugins::HttpChecksum)
|
|
81
|
+
add_plugin(Aws::Plugins::ChecksumAlgorithm)
|
|
82
|
+
add_plugin(Aws::Plugins::RequestCompression)
|
|
83
|
+
add_plugin(Aws::Plugins::DefaultsMode)
|
|
84
|
+
add_plugin(Aws::Plugins::RecursionDetection)
|
|
85
|
+
add_plugin(Aws::Plugins::Telemetry)
|
|
86
|
+
add_plugin(Aws::Plugins::Sign)
|
|
87
|
+
add_plugin(Aws::Plugins::Protocols::RestJson)
|
|
88
|
+
add_plugin(Aws::SageMakerTrainingSessionRuntime::Plugins::Endpoints)
|
|
89
|
+
|
|
90
|
+
# @overload initialize(options)
|
|
91
|
+
# @param [Hash] options
|
|
92
|
+
#
|
|
93
|
+
# @option options [Array<Seahorse::Client::Plugin>] :plugins ([]])
|
|
94
|
+
# A list of plugins to apply to the client. Each plugin is either a
|
|
95
|
+
# class name or an instance of a plugin class.
|
|
96
|
+
#
|
|
97
|
+
# @option options [required, Aws::CredentialProvider] :credentials
|
|
98
|
+
# Your AWS credentials used for authentication. This can be any class that includes and implements
|
|
99
|
+
# `Aws::CredentialProvider`, or instance of any one of the following classes:
|
|
100
|
+
#
|
|
101
|
+
# * `Aws::Credentials` - Used for configuring static, non-refreshing
|
|
102
|
+
# credentials.
|
|
103
|
+
#
|
|
104
|
+
# * `Aws::SharedCredentials` - Used for loading static credentials from a
|
|
105
|
+
# shared file, such as `~/.aws/config`.
|
|
106
|
+
#
|
|
107
|
+
# * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
|
|
108
|
+
#
|
|
109
|
+
# * `Aws::AssumeRoleWebIdentityCredentials` - Used when you need to
|
|
110
|
+
# assume a role after providing credentials via the web.
|
|
111
|
+
#
|
|
112
|
+
# * `Aws::SSOCredentials` - Used for loading credentials from AWS SSO using an
|
|
113
|
+
# access token generated from `aws login`.
|
|
114
|
+
#
|
|
115
|
+
# * `Aws::ProcessCredentials` - Used for loading credentials from a
|
|
116
|
+
# process that outputs to stdout.
|
|
117
|
+
#
|
|
118
|
+
# * `Aws::InstanceProfileCredentials` - Used for loading credentials
|
|
119
|
+
# from an EC2 IMDS on an EC2 instance.
|
|
120
|
+
#
|
|
121
|
+
# * `Aws::ECSCredentials` - Used for loading credentials from
|
|
122
|
+
# instances running in ECS.
|
|
123
|
+
#
|
|
124
|
+
# * `Aws::CognitoIdentityCredentials` - Used for loading credentials
|
|
125
|
+
# from the Cognito Identity service.
|
|
126
|
+
#
|
|
127
|
+
# When `:credentials` are not configured directly, the following locations will be searched for credentials:
|
|
128
|
+
#
|
|
129
|
+
# * `Aws.config[:credentials]`
|
|
130
|
+
#
|
|
131
|
+
# * The `:access_key_id`, `:secret_access_key`, `:session_token`, and
|
|
132
|
+
# `:account_id` options.
|
|
133
|
+
#
|
|
134
|
+
# * `ENV['AWS_ACCESS_KEY_ID']`, `ENV['AWS_SECRET_ACCESS_KEY']`,
|
|
135
|
+
# `ENV['AWS_SESSION_TOKEN']`, and `ENV['AWS_ACCOUNT_ID']`.
|
|
136
|
+
#
|
|
137
|
+
# * `~/.aws/credentials`
|
|
138
|
+
#
|
|
139
|
+
# * `~/.aws/config`
|
|
140
|
+
#
|
|
141
|
+
# * EC2/ECS IMDS instance profile - When used by default, the timeouts are very aggressive.
|
|
142
|
+
# Construct and pass an instance of `Aws::InstanceProfileCredentials` or `Aws::ECSCredentials` to
|
|
143
|
+
# enable retries and extended timeouts. Instance profile credential fetching can be disabled by
|
|
144
|
+
# setting `ENV['AWS_EC2_METADATA_DISABLED']` to `true`.
|
|
145
|
+
#
|
|
146
|
+
# @option options [required, String] :region
|
|
147
|
+
# The AWS region to connect to. The configured `:region` is
|
|
148
|
+
# used to determine the service `:endpoint`. When not passed,
|
|
149
|
+
# a default `:region` is searched for in the following locations:
|
|
150
|
+
#
|
|
151
|
+
# * `Aws.config[:region]`
|
|
152
|
+
# * `ENV['AWS_REGION']`
|
|
153
|
+
# * `ENV['AMAZON_REGION']`
|
|
154
|
+
# * `ENV['AWS_DEFAULT_REGION']`
|
|
155
|
+
# * `~/.aws/credentials`
|
|
156
|
+
# * `~/.aws/config`
|
|
157
|
+
#
|
|
158
|
+
# @option options [String] :access_key_id
|
|
159
|
+
#
|
|
160
|
+
# @option options [String] :account_id
|
|
161
|
+
#
|
|
162
|
+
# @option options [Boolean] :active_endpoint_cache (false)
|
|
163
|
+
# When set to `true`, a thread polling for endpoints will be running in
|
|
164
|
+
# the background every 60 secs (default). Defaults to `false`.
|
|
165
|
+
#
|
|
166
|
+
# @option options [Boolean] :adaptive_retry_wait_to_fill (true)
|
|
167
|
+
# Used only in `adaptive` retry mode. When true, the request will sleep
|
|
168
|
+
# until there is sufficent client side capacity to retry the request.
|
|
169
|
+
# When false, the request will raise a `RetryCapacityNotAvailableError` and will
|
|
170
|
+
# not retry instead of sleeping.
|
|
171
|
+
#
|
|
172
|
+
# @option options [Array<String>] :auth_scheme_preference
|
|
173
|
+
# A list of preferred authentication schemes to use when making a request. Supported values are:
|
|
174
|
+
# `sigv4`, `sigv4a`, `httpBearerAuth`, and `noAuth`. When set using `ENV['AWS_AUTH_SCHEME_PREFERENCE']` or in
|
|
175
|
+
# shared config as `auth_scheme_preference`, the value should be a comma-separated list.
|
|
176
|
+
#
|
|
177
|
+
# @option options [Boolean] :client_side_monitoring (false)
|
|
178
|
+
# When `true`, client-side metrics will be collected for all API requests from
|
|
179
|
+
# this client.
|
|
180
|
+
#
|
|
181
|
+
# @option options [String] :client_side_monitoring_client_id ("")
|
|
182
|
+
# Allows you to provide an identifier for this client which will be attached to
|
|
183
|
+
# all generated client side metrics. Defaults to an empty string.
|
|
184
|
+
#
|
|
185
|
+
# @option options [String] :client_side_monitoring_host ("127.0.0.1")
|
|
186
|
+
# Allows you to specify the DNS hostname or IPv4 or IPv6 address that the client
|
|
187
|
+
# side monitoring agent is running on, where client metrics will be published via UDP.
|
|
188
|
+
#
|
|
189
|
+
# @option options [Integer] :client_side_monitoring_port (31000)
|
|
190
|
+
# Required for publishing client metrics. The port that the client side monitoring
|
|
191
|
+
# agent is running on, where client metrics will be published via UDP.
|
|
192
|
+
#
|
|
193
|
+
# @option options [Aws::ClientSideMonitoring::Publisher] :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher)
|
|
194
|
+
# Allows you to provide a custom client-side monitoring publisher class. By default,
|
|
195
|
+
# will use the Client Side Monitoring Agent Publisher.
|
|
196
|
+
#
|
|
197
|
+
# @option options [Boolean] :convert_params (true)
|
|
198
|
+
# When `true`, an attempt is made to coerce request parameters into
|
|
199
|
+
# the required types.
|
|
200
|
+
#
|
|
201
|
+
# @option options [Boolean] :correct_clock_skew (true)
|
|
202
|
+
# Used only in `standard` and `adaptive` retry modes. Specifies whether to apply
|
|
203
|
+
# a clock skew correction and retry requests with skewed client clocks.
|
|
204
|
+
#
|
|
205
|
+
# @option options [String] :defaults_mode ("legacy")
|
|
206
|
+
# See {Aws::DefaultsModeConfiguration} for a list of the
|
|
207
|
+
# accepted modes and the configuration defaults that are included.
|
|
208
|
+
#
|
|
209
|
+
# @option options [Boolean] :disable_host_prefix_injection (false)
|
|
210
|
+
# When `true`, the SDK will not prepend the modeled host prefix to the endpoint.
|
|
211
|
+
#
|
|
212
|
+
# @option options [Boolean] :disable_request_compression (false)
|
|
213
|
+
# When set to 'true' the request body will not be compressed
|
|
214
|
+
# for supported operations.
|
|
215
|
+
#
|
|
216
|
+
# @option options [String, URI::HTTPS, URI::HTTP] :endpoint
|
|
217
|
+
# Normally you should not configure the `:endpoint` option
|
|
218
|
+
# directly. This is normally constructed from the `:region`
|
|
219
|
+
# option. Configuring `:endpoint` is normally reserved for
|
|
220
|
+
# connecting to test or custom endpoints. The endpoint should
|
|
221
|
+
# be a URI formatted like:
|
|
222
|
+
#
|
|
223
|
+
# 'http://example.com'
|
|
224
|
+
# 'https://example.com'
|
|
225
|
+
# 'http://example.com:123'
|
|
226
|
+
#
|
|
227
|
+
# @option options [Integer] :endpoint_cache_max_entries (1000)
|
|
228
|
+
# Used for the maximum size limit of the LRU cache storing endpoints data
|
|
229
|
+
# for endpoint discovery enabled operations. Defaults to 1000.
|
|
230
|
+
#
|
|
231
|
+
# @option options [Integer] :endpoint_cache_max_threads (10)
|
|
232
|
+
# Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.
|
|
233
|
+
#
|
|
234
|
+
# @option options [Integer] :endpoint_cache_poll_interval (60)
|
|
235
|
+
# When :endpoint_discovery and :active_endpoint_cache is enabled,
|
|
236
|
+
# Use this option to config the time interval in seconds for making
|
|
237
|
+
# requests fetching endpoints information. Defaults to 60 sec.
|
|
238
|
+
#
|
|
239
|
+
# @option options [Boolean] :endpoint_discovery (false)
|
|
240
|
+
# When set to `true`, endpoint discovery will be enabled for operations when available.
|
|
241
|
+
#
|
|
242
|
+
# @option options [Boolean] :ignore_configured_endpoint_urls
|
|
243
|
+
# Setting to true disables use of endpoint URLs provided via environment
|
|
244
|
+
# variables and the shared configuration file.
|
|
245
|
+
#
|
|
246
|
+
# @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
|
|
247
|
+
# The log formatter.
|
|
248
|
+
#
|
|
249
|
+
# @option options [Symbol] :log_level (:info)
|
|
250
|
+
# The log level to send messages to the `:logger` at.
|
|
251
|
+
#
|
|
252
|
+
# @option options [Logger] :logger
|
|
253
|
+
# The Logger instance to send log messages to. If this option
|
|
254
|
+
# is not set, logging will be disabled.
|
|
255
|
+
#
|
|
256
|
+
# @option options [Integer] :max_attempts (3)
|
|
257
|
+
# An integer representing the maximum number attempts that will be made for
|
|
258
|
+
# a single request, including the initial attempt. For example,
|
|
259
|
+
# setting this value to 5 will result in a request being retried up to
|
|
260
|
+
# 4 times. Used in `standard` and `adaptive` retry modes.
|
|
261
|
+
#
|
|
262
|
+
# @option options [String] :profile ("default")
|
|
263
|
+
# Used when loading credentials from the shared credentials file at `HOME/.aws/credentials`.
|
|
264
|
+
# When not specified, 'default' is used.
|
|
265
|
+
#
|
|
266
|
+
# @option options [String] :request_checksum_calculation ("when_supported")
|
|
267
|
+
# Determines when a checksum will be calculated for request payloads. Values are:
|
|
268
|
+
#
|
|
269
|
+
# * `when_supported` - (default) When set, a checksum will be
|
|
270
|
+
# calculated for all request payloads of operations modeled with the
|
|
271
|
+
# `httpChecksum` trait where `requestChecksumRequired` is `true` and/or a
|
|
272
|
+
# `requestAlgorithmMember` is modeled.
|
|
273
|
+
# * `when_required` - When set, a checksum will only be calculated for
|
|
274
|
+
# request payloads of operations modeled with the `httpChecksum` trait where
|
|
275
|
+
# `requestChecksumRequired` is `true` or where a `requestAlgorithmMember`
|
|
276
|
+
# is modeled and supplied.
|
|
277
|
+
#
|
|
278
|
+
# @option options [Integer] :request_min_compression_size_bytes (10240)
|
|
279
|
+
# The minimum size in bytes that triggers compression for request
|
|
280
|
+
# bodies. The value must be non-negative integer value between 0
|
|
281
|
+
# and 10485780 bytes inclusive.
|
|
282
|
+
#
|
|
283
|
+
# @option options [String] :response_checksum_validation ("when_supported")
|
|
284
|
+
# Determines when checksum validation will be performed on response payloads. Values are:
|
|
285
|
+
#
|
|
286
|
+
# * `when_supported` - (default) When set, checksum validation is performed on all
|
|
287
|
+
# response payloads of operations modeled with the `httpChecksum` trait where
|
|
288
|
+
# `responseAlgorithms` is modeled, except when no modeled checksum algorithms
|
|
289
|
+
# are supported.
|
|
290
|
+
# * `when_required` - When set, checksum validation is not performed on
|
|
291
|
+
# response payloads of operations unless the checksum algorithm is supported and
|
|
292
|
+
# the `requestValidationModeMember` member is set to `ENABLED`.
|
|
293
|
+
#
|
|
294
|
+
# @option options [Proc] :retry_backoff
|
|
295
|
+
# A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay.
|
|
296
|
+
# This option is only used in the `legacy` retry mode.
|
|
297
|
+
#
|
|
298
|
+
# @option options [Float] :retry_base_delay (0.3)
|
|
299
|
+
# The base delay in seconds used by the default backoff function. This option
|
|
300
|
+
# is only used in the `legacy` retry mode.
|
|
301
|
+
#
|
|
302
|
+
# @option options [Symbol] :retry_jitter (:none)
|
|
303
|
+
# A delay randomiser function used by the default backoff function.
|
|
304
|
+
# Some predefined functions can be referenced by name - :none, :equal, :full,
|
|
305
|
+
# otherwise a Proc that takes and returns a number. This option is only used
|
|
306
|
+
# in the `legacy` retry mode.
|
|
307
|
+
#
|
|
308
|
+
# @see https://www.awsarchitectureblog.com/2015/03/backoff.html
|
|
309
|
+
#
|
|
310
|
+
# @option options [Integer] :retry_limit (3)
|
|
311
|
+
# The maximum number of times to retry failed requests. Only
|
|
312
|
+
# ~ 500 level server errors and certain ~ 400 level client errors
|
|
313
|
+
# are retried. Generally, these are throttling errors, data
|
|
314
|
+
# checksum errors, networking errors, timeout errors, auth errors,
|
|
315
|
+
# endpoint discovery, and errors from expired credentials.
|
|
316
|
+
# This option is only used in the `legacy` retry mode.
|
|
317
|
+
#
|
|
318
|
+
# @option options [Integer] :retry_max_delay (0)
|
|
319
|
+
# The maximum number of seconds to delay between retries (0 for no limit)
|
|
320
|
+
# used by the default backoff function. This option is only used in the
|
|
321
|
+
# `legacy` retry mode.
|
|
322
|
+
#
|
|
323
|
+
# @option options [String] :retry_mode ("legacy")
|
|
324
|
+
# Specifies which retry algorithm to use. Values are:
|
|
325
|
+
#
|
|
326
|
+
# * `legacy` - The pre-existing retry behavior. This is the default
|
|
327
|
+
# value if no retry mode is provided.
|
|
328
|
+
#
|
|
329
|
+
# * `standard` - A standardized set of retry rules across the AWS SDKs.
|
|
330
|
+
# This includes support for retry quotas, which limit the number of
|
|
331
|
+
# unsuccessful retries a client can make.
|
|
332
|
+
#
|
|
333
|
+
# * `adaptive` - A retry mode that includes all the functionality of
|
|
334
|
+
# `standard` mode along with automatic client side throttling.
|
|
335
|
+
#
|
|
336
|
+
# @option options [String] :sdk_ua_app_id
|
|
337
|
+
# A unique and opaque application ID that is appended to the
|
|
338
|
+
# User-Agent header as app/sdk_ua_app_id. It should have a
|
|
339
|
+
# maximum length of 50. This variable is sourced from environment
|
|
340
|
+
# variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
|
|
341
|
+
#
|
|
342
|
+
# @option options [String] :secret_access_key
|
|
343
|
+
#
|
|
344
|
+
# @option options [String] :session_token
|
|
345
|
+
#
|
|
346
|
+
# @option options [Array] :sigv4a_signing_region_set
|
|
347
|
+
# A list of regions that should be signed with SigV4a signing. When
|
|
348
|
+
# not passed, a default `:sigv4a_signing_region_set` is searched for
|
|
349
|
+
# in the following locations:
|
|
350
|
+
#
|
|
351
|
+
# * `Aws.config[:sigv4a_signing_region_set]`
|
|
352
|
+
# * `ENV['AWS_SIGV4A_SIGNING_REGION_SET']`
|
|
353
|
+
# * `~/.aws/config`
|
|
354
|
+
#
|
|
355
|
+
# @option options [Boolean] :stub_responses (false)
|
|
356
|
+
# Causes the client to return stubbed responses. By default
|
|
357
|
+
# fake responses are generated and returned. You can specify
|
|
358
|
+
# the response data to return or errors to raise by calling
|
|
359
|
+
# {ClientStubs#stub_responses}. See {ClientStubs} for more information.
|
|
360
|
+
#
|
|
361
|
+
# ** Please note ** When response stubbing is enabled, no HTTP
|
|
362
|
+
# requests are made, and retries are disabled.
|
|
363
|
+
#
|
|
364
|
+
# @option options [Aws::Telemetry::TelemetryProviderBase] :telemetry_provider (Aws::Telemetry::NoOpTelemetryProvider)
|
|
365
|
+
# Allows you to provide a telemetry provider, which is used to
|
|
366
|
+
# emit telemetry data. By default, uses `NoOpTelemetryProvider` which
|
|
367
|
+
# will not record or emit any telemetry data. The SDK supports the
|
|
368
|
+
# following telemetry providers:
|
|
369
|
+
#
|
|
370
|
+
# * OpenTelemetry (OTel) - To use the OTel provider, install and require the
|
|
371
|
+
# `opentelemetry-sdk` gem and then, pass in an instance of a
|
|
372
|
+
# `Aws::Telemetry::OTelProvider` for telemetry provider.
|
|
373
|
+
#
|
|
374
|
+
# @option options [Aws::TokenProvider] :token_provider
|
|
375
|
+
# Your Bearer token used for authentication. This can be any class that includes and implements
|
|
376
|
+
# `Aws::TokenProvider`, or instance of any one of the following classes:
|
|
377
|
+
#
|
|
378
|
+
# * `Aws::StaticTokenProvider` - Used for configuring static, non-refreshing
|
|
379
|
+
# tokens.
|
|
380
|
+
#
|
|
381
|
+
# * `Aws::SSOTokenProvider` - Used for loading tokens from AWS SSO using an
|
|
382
|
+
# access token generated from `aws login`.
|
|
383
|
+
#
|
|
384
|
+
# When `:token_provider` is not configured directly, the `Aws::TokenProviderChain`
|
|
385
|
+
# will be used to search for tokens configured for your profile in shared configuration files.
|
|
386
|
+
#
|
|
387
|
+
# @option options [Boolean] :use_dualstack_endpoint
|
|
388
|
+
# When set to `true`, dualstack enabled endpoints (with `.aws` TLD)
|
|
389
|
+
# will be used if available.
|
|
390
|
+
#
|
|
391
|
+
# @option options [Boolean] :use_fips_endpoint
|
|
392
|
+
# When set to `true`, fips compatible endpoints will be used if available.
|
|
393
|
+
# When a `fips` region is used, the region is normalized and this config
|
|
394
|
+
# is set to `true`.
|
|
395
|
+
#
|
|
396
|
+
# @option options [Boolean] :validate_params (true)
|
|
397
|
+
# When `true`, request parameters are validated before
|
|
398
|
+
# sending the request.
|
|
399
|
+
#
|
|
400
|
+
# @option options [Aws::SageMakerTrainingSessionRuntime::EndpointProvider] :endpoint_provider
|
|
401
|
+
# The endpoint provider used to resolve endpoints. Any object that responds to
|
|
402
|
+
# `#resolve_endpoint(parameters)` where `parameters` is a Struct similar to
|
|
403
|
+
# `Aws::SageMakerTrainingSessionRuntime::EndpointParameters`.
|
|
404
|
+
#
|
|
405
|
+
# @option options [Float] :http_continue_timeout (1)
|
|
406
|
+
# The number of seconds to wait for a 100-continue response before sending the
|
|
407
|
+
# request body. This option has no effect unless the request has "Expect"
|
|
408
|
+
# header set to "100-continue". Defaults to `nil` which disables this
|
|
409
|
+
# behaviour. This value can safely be set per request on the session.
|
|
410
|
+
#
|
|
411
|
+
# @option options [Float] :http_idle_timeout (5)
|
|
412
|
+
# The number of seconds a connection is allowed to sit idle before it
|
|
413
|
+
# is considered stale. Stale connections are closed and removed from the
|
|
414
|
+
# pool before making a request.
|
|
415
|
+
#
|
|
416
|
+
# @option options [Float] :http_open_timeout (15)
|
|
417
|
+
# The default number of seconds to wait for response data.
|
|
418
|
+
# This value can safely be set per-request on the session.
|
|
419
|
+
#
|
|
420
|
+
# @option options [URI::HTTP,String] :http_proxy
|
|
421
|
+
# A proxy to send requests through. Formatted like 'http://proxy.com:123'.
|
|
422
|
+
#
|
|
423
|
+
# @option options [Float] :http_read_timeout (60)
|
|
424
|
+
# The default number of seconds to wait for response data.
|
|
425
|
+
# This value can safely be set per-request on the session.
|
|
426
|
+
#
|
|
427
|
+
# @option options [Boolean] :http_wire_trace (false)
|
|
428
|
+
# When `true`, HTTP debug output will be sent to the `:logger`.
|
|
429
|
+
#
|
|
430
|
+
# @option options [Proc] :on_chunk_received
|
|
431
|
+
# When a Proc object is provided, it will be used as callback when each chunk
|
|
432
|
+
# of the response body is received. It provides three arguments: the chunk,
|
|
433
|
+
# the number of bytes received, and the total number of
|
|
434
|
+
# bytes in the response (or nil if the server did not send a `content-length`).
|
|
435
|
+
#
|
|
436
|
+
# @option options [Proc] :on_chunk_sent
|
|
437
|
+
# When a Proc object is provided, it will be used as callback when each chunk
|
|
438
|
+
# of the request body is sent. It provides three arguments: the chunk,
|
|
439
|
+
# the number of bytes read from the body, and the total number of
|
|
440
|
+
# bytes in the body.
|
|
441
|
+
#
|
|
442
|
+
# @option options [Boolean] :raise_response_errors (true)
|
|
443
|
+
# When `true`, response errors are raised.
|
|
444
|
+
#
|
|
445
|
+
# @option options [String] :ssl_ca_bundle
|
|
446
|
+
# Full path to the SSL certificate authority bundle file that should be used when
|
|
447
|
+
# verifying peer certificates. If you do not pass `:ssl_ca_bundle` or
|
|
448
|
+
# `:ssl_ca_directory` the the system default will be used if available.
|
|
449
|
+
#
|
|
450
|
+
# @option options [String] :ssl_ca_directory
|
|
451
|
+
# Full path of the directory that contains the unbundled SSL certificate
|
|
452
|
+
# authority files for verifying peer certificates. If you do
|
|
453
|
+
# not pass `:ssl_ca_bundle` or `:ssl_ca_directory` the the system
|
|
454
|
+
# default will be used if available.
|
|
455
|
+
#
|
|
456
|
+
# @option options [String] :ssl_ca_store
|
|
457
|
+
# Sets the X509::Store to verify peer certificate.
|
|
458
|
+
#
|
|
459
|
+
# @option options [OpenSSL::X509::Certificate] :ssl_cert
|
|
460
|
+
# Sets a client certificate when creating http connections.
|
|
461
|
+
#
|
|
462
|
+
# @option options [OpenSSL::PKey] :ssl_key
|
|
463
|
+
# Sets a client key when creating http connections.
|
|
464
|
+
#
|
|
465
|
+
# @option options [Float] :ssl_timeout
|
|
466
|
+
# Sets the SSL timeout in seconds
|
|
467
|
+
#
|
|
468
|
+
# @option options [Boolean] :ssl_verify_peer (true)
|
|
469
|
+
# When `true`, SSL peer certificates are verified when establishing a connection.
|
|
470
|
+
#
|
|
471
|
+
def initialize(*args)
|
|
472
|
+
super
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
# @!group API Operations
|
|
476
|
+
|
|
477
|
+
# Submits an asynchronous sampling operation to generate text or compute
|
|
478
|
+
# log-probabilities from the model associated with the specified
|
|
479
|
+
# training session. The session must be in `Running` or `Blocked` state.
|
|
480
|
+
# Use `GetSamplingOperationResult` to poll for the result.
|
|
481
|
+
#
|
|
482
|
+
# @option params [required, String] :training_session_name
|
|
483
|
+
# The name of the training session to sample from.
|
|
484
|
+
#
|
|
485
|
+
# @option params [required, Types::SampleOperationConfig] :operation_config
|
|
486
|
+
# The configuration for the sample operation. Specify either a sample
|
|
487
|
+
# configuration to generate text or a computeLogprobs configuration to
|
|
488
|
+
# compute token log-probabilities.
|
|
489
|
+
#
|
|
490
|
+
# @return [Types::ExecuteSamplingOperationOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
|
491
|
+
#
|
|
492
|
+
# * {Types::ExecuteSamplingOperationOutput#operation_id #operation_id} => String
|
|
493
|
+
#
|
|
494
|
+
#
|
|
495
|
+
# @example Example: Generate samples from a prompt
|
|
496
|
+
#
|
|
497
|
+
# # Generates completions for a tokenized prompt using the session's current weights. Generation behavior is controlled by
|
|
498
|
+
# # `samplingParams`, and the operation is dispatched asynchronously.
|
|
499
|
+
#
|
|
500
|
+
# resp = client.execute_sampling_operation({
|
|
501
|
+
# operation_config: {
|
|
502
|
+
# sample: {
|
|
503
|
+
# num_samples: 4,
|
|
504
|
+
# prompt: {
|
|
505
|
+
# chunks: [
|
|
506
|
+
# {
|
|
507
|
+
# type: "encoded_text",
|
|
508
|
+
# tokens: [
|
|
509
|
+
# 791,
|
|
510
|
+
# 6864,
|
|
511
|
+
# 315,
|
|
512
|
+
# 9822,
|
|
513
|
+
# 374,
|
|
514
|
+
# ],
|
|
515
|
+
# },
|
|
516
|
+
# ],
|
|
517
|
+
# },
|
|
518
|
+
# sampling_params: {
|
|
519
|
+
# max_tokens: 1024,
|
|
520
|
+
# temperature: 0.7,
|
|
521
|
+
# top_p: 0.9,
|
|
522
|
+
# },
|
|
523
|
+
# },
|
|
524
|
+
# },
|
|
525
|
+
# training_session_name: "my-training-session",
|
|
526
|
+
# })
|
|
527
|
+
#
|
|
528
|
+
# resp.to_h outputs the following:
|
|
529
|
+
# {
|
|
530
|
+
# operation_id: "b2c3d4e5-6789-01bc-def0-234567890abc",
|
|
531
|
+
# }
|
|
532
|
+
#
|
|
533
|
+
# @example Request syntax with placeholder values
|
|
534
|
+
#
|
|
535
|
+
# resp = client.execute_sampling_operation({
|
|
536
|
+
# training_session_name: "TrainingSessionName", # required
|
|
537
|
+
# operation_config: { # required
|
|
538
|
+
# sample: {
|
|
539
|
+
# prompt: { # required
|
|
540
|
+
# chunks: [ # required
|
|
541
|
+
# {
|
|
542
|
+
# tokens: [1], # required
|
|
543
|
+
# type: "encoded_text", # required, accepts encoded_text
|
|
544
|
+
# },
|
|
545
|
+
# ],
|
|
546
|
+
# },
|
|
547
|
+
# num_samples: 1, # required
|
|
548
|
+
# sampling_params: { # required
|
|
549
|
+
# max_tokens: 1, # required
|
|
550
|
+
# temperature: 1.0,
|
|
551
|
+
# top_k: 1,
|
|
552
|
+
# top_p: 1.0,
|
|
553
|
+
# seed: 1,
|
|
554
|
+
# stop: ["String"],
|
|
555
|
+
# },
|
|
556
|
+
# include_prompt_logprobs: false,
|
|
557
|
+
# topk_prompt_logprobs: 1,
|
|
558
|
+
# model_package_arn: "String",
|
|
559
|
+
# },
|
|
560
|
+
# compute_logprobs: {
|
|
561
|
+
# prompt: { # required
|
|
562
|
+
# chunks: [ # required
|
|
563
|
+
# {
|
|
564
|
+
# tokens: [1], # required
|
|
565
|
+
# type: "encoded_text", # required, accepts encoded_text
|
|
566
|
+
# },
|
|
567
|
+
# ],
|
|
568
|
+
# },
|
|
569
|
+
# model_package_arn: "String",
|
|
570
|
+
# },
|
|
571
|
+
# load_weights_for_sampling: {
|
|
572
|
+
# model_package_arn: "String", # required
|
|
573
|
+
# },
|
|
574
|
+
# },
|
|
575
|
+
# })
|
|
576
|
+
#
|
|
577
|
+
# @example Response structure
|
|
578
|
+
#
|
|
579
|
+
# resp.operation_id #=> String
|
|
580
|
+
#
|
|
581
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/sagemakertrainingsessionruntime-2025-02-10/ExecuteSamplingOperation AWS API Documentation
|
|
582
|
+
#
|
|
583
|
+
# @overload execute_sampling_operation(params = {})
|
|
584
|
+
# @param [Hash] params ({})
|
|
585
|
+
def execute_sampling_operation(params = {}, options = {})
|
|
586
|
+
req = build_request(:execute_sampling_operation, params)
|
|
587
|
+
req.send_request(options)
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
# Submits an asynchronous training operation to the specified training
|
|
591
|
+
# session. The service executes operations in sequence number order. The
|
|
592
|
+
# session must be in `Running` or `Blocked` state. Use
|
|
593
|
+
# `GetTrainingOperationResult` to poll for the result. Supported
|
|
594
|
+
# operation types: `forward`, `forwardBackward`, `optimizerStep`,
|
|
595
|
+
# `saveWeights`, `saveState`, and `loadState`.
|
|
596
|
+
#
|
|
597
|
+
# @option params [required, String] :training_session_name
|
|
598
|
+
# The name of the training session to submit the operation to.
|
|
599
|
+
#
|
|
600
|
+
# @option params [required, Integer] :sequence_number
|
|
601
|
+
# The monotonically increasing sequence number that determines execution
|
|
602
|
+
# order. The training session processes operations strictly in sequence
|
|
603
|
+
# number order. If a gap exists, the session blocks until the missing
|
|
604
|
+
# operation arrives or times out. Must be at least 1.
|
|
605
|
+
#
|
|
606
|
+
# @option params [String] :client_token
|
|
607
|
+
# A unique, case-sensitive identifier that you provide to ensure that
|
|
608
|
+
# the operation completes no more than one time. If you retry a request
|
|
609
|
+
# with the same client token and the same parameters, the service
|
|
610
|
+
# ignores the request but does not return an error.
|
|
611
|
+
#
|
|
612
|
+
# @option params [required, Types::OperationConfig] :operation_config
|
|
613
|
+
# The configuration that specifies the type and parameters of the
|
|
614
|
+
# training operation. Exactly one member of the union must be set.
|
|
615
|
+
#
|
|
616
|
+
# @return [Types::ExecuteTrainingOperationOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
|
617
|
+
#
|
|
618
|
+
# * {Types::ExecuteTrainingOperationOutput#operation_id #operation_id} => String
|
|
619
|
+
#
|
|
620
|
+
#
|
|
621
|
+
# @example Example: Run a forward and backward pass
|
|
622
|
+
#
|
|
623
|
+
# # Computes gradients for a batch of tokenized prompts and accumulates them into the session. Operations are applied in
|
|
624
|
+
# # `sequenceNumber` order, so each call must supply the next number in the sequence.
|
|
625
|
+
#
|
|
626
|
+
# resp = client.execute_training_operation({
|
|
627
|
+
# operation_config: {
|
|
628
|
+
# forward_backward: {
|
|
629
|
+
# datum_list: [
|
|
630
|
+
# {
|
|
631
|
+
# model_input: {
|
|
632
|
+
# chunks: [
|
|
633
|
+
# {
|
|
634
|
+
# type: "encoded_text",
|
|
635
|
+
# tokens: [
|
|
636
|
+
# 791,
|
|
637
|
+
# 6864,
|
|
638
|
+
# 315,
|
|
639
|
+
# 9822,
|
|
640
|
+
# 374,
|
|
641
|
+
# 12366,
|
|
642
|
+
# ],
|
|
643
|
+
# },
|
|
644
|
+
# ],
|
|
645
|
+
# },
|
|
646
|
+
# },
|
|
647
|
+
# ],
|
|
648
|
+
# loss_fn_name: "cross_entropy",
|
|
649
|
+
# },
|
|
650
|
+
# },
|
|
651
|
+
# sequence_number: 1,
|
|
652
|
+
# training_session_name: "my-training-session",
|
|
653
|
+
# })
|
|
654
|
+
#
|
|
655
|
+
# resp.to_h outputs the following:
|
|
656
|
+
# {
|
|
657
|
+
# operation_id: "a1b2c3d4-5678-90ab-cdef-1234567890ab",
|
|
658
|
+
# }
|
|
659
|
+
#
|
|
660
|
+
# @example Request syntax with placeholder values
|
|
661
|
+
#
|
|
662
|
+
# resp = client.execute_training_operation({
|
|
663
|
+
# training_session_name: "TrainingSessionName", # required
|
|
664
|
+
# sequence_number: 1, # required
|
|
665
|
+
# client_token: "ClientToken",
|
|
666
|
+
# operation_config: { # required
|
|
667
|
+
# forward: {
|
|
668
|
+
# loss_fn_name: "cross_entropy", # required, accepts cross_entropy, importance_sampling, ppo, cispo
|
|
669
|
+
# datum_list: [ # required
|
|
670
|
+
# {
|
|
671
|
+
# model_input: { # required
|
|
672
|
+
# chunks: [ # required
|
|
673
|
+
# {
|
|
674
|
+
# tokens: [1], # required
|
|
675
|
+
# type: "encoded_text", # required, accepts encoded_text
|
|
676
|
+
# },
|
|
677
|
+
# ],
|
|
678
|
+
# },
|
|
679
|
+
# loss_fn_inputs: {
|
|
680
|
+
# "String" => {
|
|
681
|
+
# data: { # required
|
|
682
|
+
# },
|
|
683
|
+
# dtype: "String", # required
|
|
684
|
+
# shape: [1],
|
|
685
|
+
# },
|
|
686
|
+
# },
|
|
687
|
+
# },
|
|
688
|
+
# ],
|
|
689
|
+
# loss_fn_config: {
|
|
690
|
+
# },
|
|
691
|
+
# },
|
|
692
|
+
# forward_backward: {
|
|
693
|
+
# loss_fn_name: "cross_entropy", # required, accepts cross_entropy, importance_sampling, ppo, cispo
|
|
694
|
+
# datum_list: [ # required
|
|
695
|
+
# {
|
|
696
|
+
# model_input: { # required
|
|
697
|
+
# chunks: [ # required
|
|
698
|
+
# {
|
|
699
|
+
# tokens: [1], # required
|
|
700
|
+
# type: "encoded_text", # required, accepts encoded_text
|
|
701
|
+
# },
|
|
702
|
+
# ],
|
|
703
|
+
# },
|
|
704
|
+
# loss_fn_inputs: {
|
|
705
|
+
# "String" => {
|
|
706
|
+
# data: { # required
|
|
707
|
+
# },
|
|
708
|
+
# dtype: "String", # required
|
|
709
|
+
# shape: [1],
|
|
710
|
+
# },
|
|
711
|
+
# },
|
|
712
|
+
# },
|
|
713
|
+
# ],
|
|
714
|
+
# loss_fn_config: {
|
|
715
|
+
# },
|
|
716
|
+
# },
|
|
717
|
+
# optimizer_step: {
|
|
718
|
+
# adam_params_config: { # required
|
|
719
|
+
# learning_rate: 1.0, # required
|
|
720
|
+
# beta1: 1.0,
|
|
721
|
+
# beta2: 1.0,
|
|
722
|
+
# eps: 1.0,
|
|
723
|
+
# weight_decay: 1.0,
|
|
724
|
+
# grad_clip_norm: 1.0,
|
|
725
|
+
# lora_plus_lr_ratio: 1.0,
|
|
726
|
+
# },
|
|
727
|
+
# },
|
|
728
|
+
# save_weights: {
|
|
729
|
+
# merge_weights: false,
|
|
730
|
+
# description: "SaveWeightsConfigDescriptionString",
|
|
731
|
+
# },
|
|
732
|
+
# save_state: {
|
|
733
|
+
# description: "SaveStateConfigDescriptionString",
|
|
734
|
+
# },
|
|
735
|
+
# load_state: {
|
|
736
|
+
# model_package_arn: "String", # required
|
|
737
|
+
# load_optimizer: false, # required
|
|
738
|
+
# },
|
|
739
|
+
# },
|
|
740
|
+
# })
|
|
741
|
+
#
|
|
742
|
+
# @example Response structure
|
|
743
|
+
#
|
|
744
|
+
# resp.operation_id #=> String
|
|
745
|
+
#
|
|
746
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/sagemakertrainingsessionruntime-2025-02-10/ExecuteTrainingOperation AWS API Documentation
|
|
747
|
+
#
|
|
748
|
+
# @overload execute_training_operation(params = {})
|
|
749
|
+
# @param [Hash] params ({})
|
|
750
|
+
def execute_training_operation(params = {}, options = {})
|
|
751
|
+
req = build_request(:execute_training_operation, params)
|
|
752
|
+
req.send_request(options)
|
|
753
|
+
end
|
|
754
|
+
|
|
755
|
+
# Retrieves the current status and result of a previously submitted
|
|
756
|
+
# sampling operation. Poll this operation until the status reaches a
|
|
757
|
+
# terminal state (Completed or Failed).
|
|
758
|
+
#
|
|
759
|
+
# @option params [required, String] :training_session_name
|
|
760
|
+
# The name of the training session that owns the sample operation.
|
|
761
|
+
#
|
|
762
|
+
# @option params [required, String] :operation_id
|
|
763
|
+
# The unique identifier of the sample operation to retrieve, returned by
|
|
764
|
+
# `ExecuteSamplingOperation`.
|
|
765
|
+
#
|
|
766
|
+
# @return [Types::GetSamplingOperationResultOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
|
767
|
+
#
|
|
768
|
+
# * {Types::GetSamplingOperationResultOutput#status #status} => String
|
|
769
|
+
# * {Types::GetSamplingOperationResultOutput#operation_result #operation_result} => Types::SampleOperationResult
|
|
770
|
+
# * {Types::GetSamplingOperationResultOutput#error_details #error_details} => String
|
|
771
|
+
#
|
|
772
|
+
#
|
|
773
|
+
# @example Example: Get the result of a sampling operation
|
|
774
|
+
#
|
|
775
|
+
# # Retrieves the status and generated sequences for a sampling operation submitted with ExecuteSamplingOperation.
|
|
776
|
+
#
|
|
777
|
+
# resp = client.get_sampling_operation_result({
|
|
778
|
+
# operation_id: "a1b2c3d4-5678-90ab-cdef-1234567890ab",
|
|
779
|
+
# training_session_name: "my-training-session",
|
|
780
|
+
# })
|
|
781
|
+
#
|
|
782
|
+
# resp.to_h outputs the following:
|
|
783
|
+
# {
|
|
784
|
+
# operation_result: {
|
|
785
|
+
# sample: {
|
|
786
|
+
# sequences: [
|
|
787
|
+
# {
|
|
788
|
+
# stop_reason: "stop",
|
|
789
|
+
# token_usage: {
|
|
790
|
+
# decode: 7,
|
|
791
|
+
# prefill: 5,
|
|
792
|
+
# },
|
|
793
|
+
# tokens: [
|
|
794
|
+
# 791,
|
|
795
|
+
# 6864,
|
|
796
|
+
# 315,
|
|
797
|
+
# 9822,
|
|
798
|
+
# 374,
|
|
799
|
+
# 12366,
|
|
800
|
+
# 13,
|
|
801
|
+
# ],
|
|
802
|
+
# },
|
|
803
|
+
# ],
|
|
804
|
+
# },
|
|
805
|
+
# },
|
|
806
|
+
# status: "Completed",
|
|
807
|
+
# }
|
|
808
|
+
#
|
|
809
|
+
# @example Request syntax with placeholder values
|
|
810
|
+
#
|
|
811
|
+
# resp = client.get_sampling_operation_result({
|
|
812
|
+
# training_session_name: "TrainingSessionName", # required
|
|
813
|
+
# operation_id: "OperationId", # required
|
|
814
|
+
# })
|
|
815
|
+
#
|
|
816
|
+
# @example Response structure
|
|
817
|
+
#
|
|
818
|
+
# resp.status #=> String, one of "Pending", "InProgress", "Completed", "Failed", "Skipped"
|
|
819
|
+
# resp.operation_result.sample.sequences #=> Array
|
|
820
|
+
# resp.operation_result.sample.sequences[0].stop_reason #=> String, one of "stop", "length"
|
|
821
|
+
# resp.operation_result.sample.sequences[0].tokens #=> Array
|
|
822
|
+
# resp.operation_result.sample.sequences[0].tokens[0] #=> Integer
|
|
823
|
+
# resp.operation_result.sample.sequences[0].logprobs #=> Array
|
|
824
|
+
# resp.operation_result.sample.sequences[0].logprobs[0] #=> Float
|
|
825
|
+
# resp.operation_result.sample.sequences[0].token_usage.prefill #=> Integer
|
|
826
|
+
# resp.operation_result.sample.sequences[0].token_usage.decode #=> Integer
|
|
827
|
+
# resp.operation_result.sample.prompt_logprobs #=> Array
|
|
828
|
+
# resp.operation_result.sample.prompt_logprobs[0] #=> Float
|
|
829
|
+
# resp.operation_result.sample.topk_prompt_logprobs #=> Array
|
|
830
|
+
# resp.operation_result.sample.topk_prompt_logprobs[0] #=> Array
|
|
831
|
+
# resp.operation_result.sample.topk_prompt_logprobs[0][0].token_id #=> Integer
|
|
832
|
+
# resp.operation_result.sample.topk_prompt_logprobs[0][0].logprob #=> Float
|
|
833
|
+
# resp.operation_result.compute_logprobs.logprobs #=> Array
|
|
834
|
+
# resp.operation_result.compute_logprobs.logprobs[0] #=> Float
|
|
835
|
+
# resp.error_details #=> String
|
|
836
|
+
#
|
|
837
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/sagemakertrainingsessionruntime-2025-02-10/GetSamplingOperationResult AWS API Documentation
|
|
838
|
+
#
|
|
839
|
+
# @overload get_sampling_operation_result(params = {})
|
|
840
|
+
# @param [Hash] params ({})
|
|
841
|
+
def get_sampling_operation_result(params = {}, options = {})
|
|
842
|
+
req = build_request(:get_sampling_operation_result, params)
|
|
843
|
+
req.send_request(options)
|
|
844
|
+
end
|
|
845
|
+
|
|
846
|
+
# Retrieves the current status and result of a previously submitted
|
|
847
|
+
# training operation. Poll this operation until the status reaches a
|
|
848
|
+
# terminal state (Completed, Failed, or Skipped).
|
|
849
|
+
#
|
|
850
|
+
# @option params [required, String] :training_session_name
|
|
851
|
+
# The name of the training session that owns the operation.
|
|
852
|
+
#
|
|
853
|
+
# @option params [required, String] :operation_id
|
|
854
|
+
# The unique identifier of the operation to retrieve, returned by
|
|
855
|
+
# `ExecuteTrainingOperation`.
|
|
856
|
+
#
|
|
857
|
+
# @return [Types::GetTrainingOperationResultOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
|
858
|
+
#
|
|
859
|
+
# * {Types::GetTrainingOperationResultOutput#status #status} => String
|
|
860
|
+
# * {Types::GetTrainingOperationResultOutput#operation_result #operation_result} => Types::OperationResult
|
|
861
|
+
# * {Types::GetTrainingOperationResultOutput#error_details #error_details} => String
|
|
862
|
+
# * {Types::GetTrainingOperationResultOutput#token_usage #token_usage} => Types::TrainingTokenUsage
|
|
863
|
+
#
|
|
864
|
+
#
|
|
865
|
+
# @example Example: Get the result of a training operation
|
|
866
|
+
#
|
|
867
|
+
# # Retrieves the status and result of a training operation submitted with ExecuteTrainingOperation.
|
|
868
|
+
#
|
|
869
|
+
# resp = client.get_training_operation_result({
|
|
870
|
+
# operation_id: "a1b2c3d4-5678-90ab-cdef-1234567890ab",
|
|
871
|
+
# training_session_name: "my-training-session",
|
|
872
|
+
# })
|
|
873
|
+
#
|
|
874
|
+
# resp.to_h outputs the following:
|
|
875
|
+
# {
|
|
876
|
+
# operation_result: {
|
|
877
|
+
# forward_backward: {
|
|
878
|
+
# loss_fn_output_type: "logprobs",
|
|
879
|
+
# metrics: {
|
|
880
|
+
# "loss" => 1.8342,
|
|
881
|
+
# },
|
|
882
|
+
# },
|
|
883
|
+
# },
|
|
884
|
+
# status: "Completed",
|
|
885
|
+
# token_usage: {
|
|
886
|
+
# training_tokens: 4096,
|
|
887
|
+
# },
|
|
888
|
+
# }
|
|
889
|
+
#
|
|
890
|
+
# @example Request syntax with placeholder values
|
|
891
|
+
#
|
|
892
|
+
# resp = client.get_training_operation_result({
|
|
893
|
+
# training_session_name: "TrainingSessionName", # required
|
|
894
|
+
# operation_id: "OperationId", # required
|
|
895
|
+
# })
|
|
896
|
+
#
|
|
897
|
+
# @example Response structure
|
|
898
|
+
#
|
|
899
|
+
# resp.status #=> String, one of "Pending", "InProgress", "Completed", "Failed", "Skipped"
|
|
900
|
+
# resp.operation_result.forward.loss_fn_output_type #=> String
|
|
901
|
+
# resp.operation_result.forward.loss_fn_outputs #=> Array
|
|
902
|
+
# resp.operation_result.forward.loss_fn_outputs[0] #=> Hash
|
|
903
|
+
# resp.operation_result.forward.loss_fn_outputs[0]["String"].dtype #=> String
|
|
904
|
+
# resp.operation_result.forward.loss_fn_outputs[0]["String"].shape #=> Array
|
|
905
|
+
# resp.operation_result.forward.loss_fn_outputs[0]["String"].shape[0] #=> Integer
|
|
906
|
+
# resp.operation_result.forward.metrics #=> Hash
|
|
907
|
+
# resp.operation_result.forward.metrics["String"] #=> Float
|
|
908
|
+
# resp.operation_result.forward.token_usage.training_tokens #=> Integer
|
|
909
|
+
# resp.operation_result.forward_backward.loss_fn_output_type #=> String
|
|
910
|
+
# resp.operation_result.forward_backward.loss_fn_outputs #=> Array
|
|
911
|
+
# resp.operation_result.forward_backward.loss_fn_outputs[0] #=> Hash
|
|
912
|
+
# resp.operation_result.forward_backward.loss_fn_outputs[0]["String"].dtype #=> String
|
|
913
|
+
# resp.operation_result.forward_backward.loss_fn_outputs[0]["String"].shape #=> Array
|
|
914
|
+
# resp.operation_result.forward_backward.loss_fn_outputs[0]["String"].shape[0] #=> Integer
|
|
915
|
+
# resp.operation_result.forward_backward.metrics #=> Hash
|
|
916
|
+
# resp.operation_result.forward_backward.metrics["String"] #=> Float
|
|
917
|
+
# resp.operation_result.forward_backward.token_usage.training_tokens #=> Integer
|
|
918
|
+
# resp.operation_result.optimizer_step.metrics #=> Hash
|
|
919
|
+
# resp.operation_result.optimizer_step.metrics["String"] #=> Float
|
|
920
|
+
# resp.operation_result.save_weights.model_package_arn #=> String
|
|
921
|
+
# resp.operation_result.save_state.model_package_arn #=> String
|
|
922
|
+
# resp.error_details #=> String
|
|
923
|
+
# resp.token_usage.training_tokens #=> Integer
|
|
924
|
+
#
|
|
925
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/sagemakertrainingsessionruntime-2025-02-10/GetTrainingOperationResult AWS API Documentation
|
|
926
|
+
#
|
|
927
|
+
# @overload get_training_operation_result(params = {})
|
|
928
|
+
# @param [Hash] params ({})
|
|
929
|
+
def get_training_operation_result(params = {}, options = {})
|
|
930
|
+
req = build_request(:get_training_operation_result, params)
|
|
931
|
+
req.send_request(options)
|
|
932
|
+
end
|
|
933
|
+
|
|
934
|
+
# Sends an inference request to the model associated with the specified
|
|
935
|
+
# training session and returns the response synchronously. The service
|
|
936
|
+
# passes the request and response bodies to and from the model without
|
|
937
|
+
# modification.
|
|
938
|
+
#
|
|
939
|
+
# @option params [required, String] :training_session_name
|
|
940
|
+
# The name of the training session whose model to invoke.
|
|
941
|
+
#
|
|
942
|
+
# @option params [String] :content_type
|
|
943
|
+
# The MIME type of the input data in the request body.
|
|
944
|
+
#
|
|
945
|
+
# @option params [String] :accept
|
|
946
|
+
# The desired MIME type of the inference body in the response.
|
|
947
|
+
#
|
|
948
|
+
# @option params [String] :model_package_arn
|
|
949
|
+
# The ARN of the model package whose checkpoint to invoke.
|
|
950
|
+
#
|
|
951
|
+
# @option params [String, StringIO, File] :body
|
|
952
|
+
# The raw inference request body.
|
|
953
|
+
#
|
|
954
|
+
# @return [Types::SampleTrainingSessionOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
|
955
|
+
#
|
|
956
|
+
# * {Types::SampleTrainingSessionOutput#content_type #content_type} => String
|
|
957
|
+
# * {Types::SampleTrainingSessionOutput#body #body} => String
|
|
958
|
+
#
|
|
959
|
+
#
|
|
960
|
+
# @example Example: Sample from a training session
|
|
961
|
+
#
|
|
962
|
+
# # Sends a chat completion request to the session's current weights and receives the complete response in a single payload.
|
|
963
|
+
#
|
|
964
|
+
# resp = client.sample_training_session({
|
|
965
|
+
# accept: "application/json",
|
|
966
|
+
# body: "eyJtZXNzYWdlcyI6W3sicm9sZSI6InVzZXIiLCJjb250ZW50IjoiV2hhdCBpcyB0aGUgY2FwaXRhbCBvZiBGcmFuY2U/In1dLCJtYXhfdG9rZW5zIjoxMjh9",
|
|
967
|
+
# content_type: "application/json",
|
|
968
|
+
# training_session_name: "my-training-session",
|
|
969
|
+
# })
|
|
970
|
+
#
|
|
971
|
+
# resp.to_h outputs the following:
|
|
972
|
+
# {
|
|
973
|
+
# body: "eyJjaG9pY2VzIjpbeyJtZXNzYWdlIjp7InJvbGUiOiJhc3Npc3RhbnQiLCJjb250ZW50IjoiUGFyaXMifSwiZmluaXNoX3JlYXNvbiI6InN0b3AifV19",
|
|
974
|
+
# content_type: "application/json",
|
|
975
|
+
# }
|
|
976
|
+
#
|
|
977
|
+
# @example Request syntax with placeholder values
|
|
978
|
+
#
|
|
979
|
+
# resp = client.sample_training_session({
|
|
980
|
+
# training_session_name: "TrainingSessionName", # required
|
|
981
|
+
# content_type: "String",
|
|
982
|
+
# accept: "String",
|
|
983
|
+
# model_package_arn: "String",
|
|
984
|
+
# body: "data",
|
|
985
|
+
# })
|
|
986
|
+
#
|
|
987
|
+
# @example Response structure
|
|
988
|
+
#
|
|
989
|
+
# resp.content_type #=> String
|
|
990
|
+
# resp.body #=> String
|
|
991
|
+
#
|
|
992
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/sagemakertrainingsessionruntime-2025-02-10/SampleTrainingSession AWS API Documentation
|
|
993
|
+
#
|
|
994
|
+
# @overload sample_training_session(params = {})
|
|
995
|
+
# @param [Hash] params ({})
|
|
996
|
+
def sample_training_session(params = {}, options = {})
|
|
997
|
+
req = build_request(:sample_training_session, params)
|
|
998
|
+
req.send_request(options)
|
|
999
|
+
end
|
|
1000
|
+
|
|
1001
|
+
# Streams inference responses from the model associated with the
|
|
1002
|
+
# specified training session. Use this operation for real-time
|
|
1003
|
+
# token-by-token generation. The service passes the request body to the
|
|
1004
|
+
# model without modification.
|
|
1005
|
+
#
|
|
1006
|
+
# @option params [required, String] :training_session_name
|
|
1007
|
+
# The name of the training session whose model to invoke.
|
|
1008
|
+
#
|
|
1009
|
+
# @option params [String] :content_type
|
|
1010
|
+
# The MIME type of the input data in the request body.
|
|
1011
|
+
#
|
|
1012
|
+
# @option params [String] :accept
|
|
1013
|
+
# The desired MIME type of the inference body in the response.
|
|
1014
|
+
#
|
|
1015
|
+
# @option params [String] :model_package_arn
|
|
1016
|
+
# The ARN of the model package whose checkpoint to invoke.
|
|
1017
|
+
#
|
|
1018
|
+
# @option params [String, StringIO, File] :body
|
|
1019
|
+
# The raw inference request body.
|
|
1020
|
+
#
|
|
1021
|
+
# @return [Types::SampleTrainingSessionWithResponseStreamOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
|
1022
|
+
#
|
|
1023
|
+
# * {Types::SampleTrainingSessionWithResponseStreamOutput#content_type #content_type} => String
|
|
1024
|
+
# * {Types::SampleTrainingSessionWithResponseStreamOutput#body #body} => IO
|
|
1025
|
+
#
|
|
1026
|
+
#
|
|
1027
|
+
# @example Example: Stream samples from a training session
|
|
1028
|
+
#
|
|
1029
|
+
# # Sends a chat completion request to the session's current weights and receives the response as a stream of payload
|
|
1030
|
+
# # chunks.
|
|
1031
|
+
#
|
|
1032
|
+
# resp = client.sample_training_session_with_response_stream({
|
|
1033
|
+
# accept: "application/json",
|
|
1034
|
+
# body: "eyJtZXNzYWdlcyI6W3sicm9sZSI6InVzZXIiLCJjb250ZW50IjoiV2hhdCBpcyB0aGUgY2FwaXRhbCBvZiBGcmFuY2U/In1dLCJtYXhfdG9rZW5zIjoxMjgsInN0cmVhbSI6dHJ1ZX0=",
|
|
1035
|
+
# content_type: "application/json",
|
|
1036
|
+
# training_session_name: "my-training-session",
|
|
1037
|
+
# })
|
|
1038
|
+
#
|
|
1039
|
+
# @example Request syntax with placeholder values
|
|
1040
|
+
#
|
|
1041
|
+
# resp = client.sample_training_session_with_response_stream({
|
|
1042
|
+
# training_session_name: "TrainingSessionName", # required
|
|
1043
|
+
# content_type: "String",
|
|
1044
|
+
# accept: "String",
|
|
1045
|
+
# model_package_arn: "String",
|
|
1046
|
+
# body: "data",
|
|
1047
|
+
# })
|
|
1048
|
+
#
|
|
1049
|
+
# @example Response structure
|
|
1050
|
+
#
|
|
1051
|
+
# resp.content_type #=> String
|
|
1052
|
+
# resp.body #=> IO
|
|
1053
|
+
#
|
|
1054
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/sagemakertrainingsessionruntime-2025-02-10/SampleTrainingSessionWithResponseStream AWS API Documentation
|
|
1055
|
+
#
|
|
1056
|
+
# @overload sample_training_session_with_response_stream(params = {})
|
|
1057
|
+
# @param [Hash] params ({})
|
|
1058
|
+
def sample_training_session_with_response_stream(params = {}, options = {}, &block)
|
|
1059
|
+
req = build_request(:sample_training_session_with_response_stream, params)
|
|
1060
|
+
req.send_request(options, &block)
|
|
1061
|
+
end
|
|
1062
|
+
|
|
1063
|
+
# @!endgroup
|
|
1064
|
+
|
|
1065
|
+
# @param params ({})
|
|
1066
|
+
# @api private
|
|
1067
|
+
def build_request(operation_name, params = {})
|
|
1068
|
+
handlers = @handlers.for(operation_name)
|
|
1069
|
+
tracer = config.telemetry_provider.tracer_provider.tracer(
|
|
1070
|
+
Aws::Telemetry.module_to_tracer_name('Aws::SageMakerTrainingSessionRuntime')
|
|
1071
|
+
)
|
|
1072
|
+
context = Seahorse::Client::RequestContext.new(
|
|
1073
|
+
operation_name: operation_name,
|
|
1074
|
+
operation: config.api.operation(operation_name),
|
|
1075
|
+
client: self,
|
|
1076
|
+
params: params,
|
|
1077
|
+
config: config,
|
|
1078
|
+
tracer: tracer
|
|
1079
|
+
)
|
|
1080
|
+
context[:gem_name] = 'aws-sdk-sagemakertrainingsessionruntime'
|
|
1081
|
+
context[:gem_version] = '1.0.0'
|
|
1082
|
+
Seahorse::Client::Request.new(handlers, context)
|
|
1083
|
+
end
|
|
1084
|
+
|
|
1085
|
+
# @api private
|
|
1086
|
+
# @deprecated
|
|
1087
|
+
def waiter_names
|
|
1088
|
+
[]
|
|
1089
|
+
end
|
|
1090
|
+
|
|
1091
|
+
class << self
|
|
1092
|
+
|
|
1093
|
+
# @api private
|
|
1094
|
+
attr_reader :identifier
|
|
1095
|
+
|
|
1096
|
+
# @api private
|
|
1097
|
+
def errors_module
|
|
1098
|
+
Errors
|
|
1099
|
+
end
|
|
1100
|
+
|
|
1101
|
+
end
|
|
1102
|
+
end
|
|
1103
|
+
end
|