@aws-sdk/client-sagemakertrainingsessionruntime 0.0.0-stage → 3.1151.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.
Files changed (85) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +222 -2
  3. package/dist-cjs/index.js +913 -0
  4. package/dist-es/SageMakerTrainingSessionRuntime.js +19 -0
  5. package/dist-es/SageMakerTrainingSessionRuntimeClient.js +47 -0
  6. package/dist-es/auth/httpAuthExtensionConfiguration.js +38 -0
  7. package/dist-es/auth/httpAuthSchemeProvider.js +40 -0
  8. package/dist-es/commandBuilder.js +6 -0
  9. package/dist-es/commands/ExecuteSamplingOperationCommand.js +4 -0
  10. package/dist-es/commands/ExecuteTrainingOperationCommand.js +4 -0
  11. package/dist-es/commands/GetSamplingOperationResultCommand.js +4 -0
  12. package/dist-es/commands/GetTrainingOperationResultCommand.js +4 -0
  13. package/dist-es/commands/SampleTrainingSessionCommand.js +4 -0
  14. package/dist-es/commands/SampleTrainingSessionWithResponseStreamCommand.js +4 -0
  15. package/dist-es/commands/index.js +6 -0
  16. package/dist-es/endpoint/EndpointParameters.js +11 -0
  17. package/dist-es/endpoint/bdd.js +29 -0
  18. package/dist-es/endpoint/endpointResolver.js +14 -0
  19. package/dist-es/extensionConfiguration.js +1 -0
  20. package/dist-es/index.js +9 -0
  21. package/dist-es/models/SageMakerTrainingSessionRuntimeServiceException.js +9 -0
  22. package/dist-es/models/enums.js +20 -0
  23. package/dist-es/models/errors.js +66 -0
  24. package/dist-es/models/models_0.js +1 -0
  25. package/dist-es/runtimeConfig.browser.js +29 -0
  26. package/dist-es/runtimeConfig.js +43 -0
  27. package/dist-es/runtimeConfig.native.js +9 -0
  28. package/dist-es/runtimeConfig.shared.js +41 -0
  29. package/dist-es/runtimeExtensions.js +9 -0
  30. package/dist-es/schemas/schemas_0.js +454 -0
  31. package/dist-types/SageMakerTrainingSessionRuntime.d.ts +58 -0
  32. package/dist-types/SageMakerTrainingSessionRuntimeClient.d.ts +197 -0
  33. package/dist-types/auth/httpAuthExtensionConfiguration.d.ts +29 -0
  34. package/dist-types/auth/httpAuthSchemeProvider.d.ts +75 -0
  35. package/dist-types/commandBuilder.d.ts +18 -0
  36. package/dist-types/commands/ExecuteSamplingOperationCommand.d.ts +169 -0
  37. package/dist-types/commands/ExecuteTrainingOperationCommand.d.ts +206 -0
  38. package/dist-types/commands/GetSamplingOperationResultCommand.d.ts +159 -0
  39. package/dist-types/commands/GetTrainingOperationResultCommand.d.ts +169 -0
  40. package/dist-types/commands/SampleTrainingSessionCommand.d.ts +123 -0
  41. package/dist-types/commands/SampleTrainingSessionWithResponseStreamCommand.d.ts +124 -0
  42. package/dist-types/commands/index.d.ts +6 -0
  43. package/dist-types/endpoint/EndpointParameters.d.ts +44 -0
  44. package/dist-types/endpoint/bdd.d.ts +2 -0
  45. package/dist-types/endpoint/endpointResolver.d.ts +8 -0
  46. package/dist-types/extensionConfiguration.d.ts +9 -0
  47. package/dist-types/index.d.ts +17 -0
  48. package/dist-types/models/SageMakerTrainingSessionRuntimeServiceException.d.ts +15 -0
  49. package/dist-types/models/enums.d.ts +52 -0
  50. package/dist-types/models/errors.d.ts +67 -0
  51. package/dist-types/models/models_0.d.ts +1069 -0
  52. package/dist-types/runtimeConfig.browser.d.ts +58 -0
  53. package/dist-types/runtimeConfig.d.ts +58 -0
  54. package/dist-types/runtimeConfig.native.d.ts +57 -0
  55. package/dist-types/runtimeConfig.shared.d.ts +29 -0
  56. package/dist-types/runtimeExtensions.d.ts +17 -0
  57. package/dist-types/schemas/schemas_0.d.ts +64 -0
  58. package/dist-types/ts3.4/SageMakerTrainingSessionRuntime.d.ts +115 -0
  59. package/dist-types/ts3.4/SageMakerTrainingSessionRuntimeClient.d.ts +143 -0
  60. package/dist-types/ts3.4/auth/httpAuthExtensionConfiguration.d.ts +27 -0
  61. package/dist-types/ts3.4/auth/httpAuthSchemeProvider.d.ts +43 -0
  62. package/dist-types/ts3.4/commandBuilder.d.ts +40 -0
  63. package/dist-types/ts3.4/commands/ExecuteSamplingOperationCommand.d.ts +39 -0
  64. package/dist-types/ts3.4/commands/ExecuteTrainingOperationCommand.d.ts +39 -0
  65. package/dist-types/ts3.4/commands/GetSamplingOperationResultCommand.d.ts +42 -0
  66. package/dist-types/ts3.4/commands/GetTrainingOperationResultCommand.d.ts +42 -0
  67. package/dist-types/ts3.4/commands/SampleTrainingSessionCommand.d.ts +52 -0
  68. package/dist-types/ts3.4/commands/SampleTrainingSessionWithResponseStreamCommand.d.ts +59 -0
  69. package/dist-types/ts3.4/commands/index.d.ts +6 -0
  70. package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +45 -0
  71. package/dist-types/ts3.4/endpoint/bdd.d.ts +2 -0
  72. package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
  73. package/dist-types/ts3.4/extensionConfiguration.d.ts +10 -0
  74. package/dist-types/ts3.4/index.d.ts +12 -0
  75. package/dist-types/ts3.4/models/SageMakerTrainingSessionRuntimeServiceException.d.ts +10 -0
  76. package/dist-types/ts3.4/models/enums.d.ts +24 -0
  77. package/dist-types/ts3.4/models/errors.d.ts +32 -0
  78. package/dist-types/ts3.4/models/models_0.d.ts +417 -0
  79. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +94 -0
  80. package/dist-types/ts3.4/runtimeConfig.d.ts +96 -0
  81. package/dist-types/ts3.4/runtimeConfig.native.d.ts +98 -0
  82. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +32 -0
  83. package/dist-types/ts3.4/runtimeExtensions.d.ts +11 -0
  84. package/dist-types/ts3.4/schemas/schemas_0.d.ts +64 -0
  85. package/package.json +67 -4
@@ -0,0 +1,1069 @@
1
+ import type { DocumentType as __DocumentType, StreamingBlobTypes } from "@smithy/types";
2
+ import type { EncodedTextChunkType, LossFnName, RequestStatus, StopReason } from "./enums";
3
+ /**
4
+ * <p>The Adam optimizer hyperparameters used during an optimizer step.</p>
5
+ * @public
6
+ */
7
+ export interface AdamParamsConfig {
8
+ /**
9
+ * <p>The learning rate for the optimizer. Must be greater than 0.</p>
10
+ * @public
11
+ */
12
+ learningRate: number | undefined;
13
+ /**
14
+ * <p>The exponential decay rate for the first moment estimates.</p>
15
+ * @public
16
+ */
17
+ beta1?: number | undefined;
18
+ /**
19
+ * <p>The exponential decay rate for the second moment estimates.</p>
20
+ * @public
21
+ */
22
+ beta2?: number | undefined;
23
+ /**
24
+ * <p>A small constant added to the denominator for numerical stability.</p>
25
+ * @public
26
+ */
27
+ eps?: number | undefined;
28
+ /**
29
+ * <p>The weight decay (L2 regularization) coefficient.</p>
30
+ * @public
31
+ */
32
+ weightDecay?: number | undefined;
33
+ /**
34
+ * <p>The maximum gradient norm for gradient clipping. Gradients are scaled down if their norm exceeds this value.</p>
35
+ * @public
36
+ */
37
+ gradClipNorm?: number | undefined;
38
+ /**
39
+ * <p>The learning rate multiplier for LoRA+ B matrices relative to A matrices. When set, B matrices use <code>learningRate * loraPlusLrRatio</code> while A matrices use the base learning rate.</p>
40
+ * @public
41
+ */
42
+ loraPlusLrRatio?: number | undefined;
43
+ }
44
+ /**
45
+ * <p>A chunk of pre-tokenized text represented as a list of token IDs.</p>
46
+ * @public
47
+ */
48
+ export interface EncodedTextChunk {
49
+ /**
50
+ * <p>The token IDs representing the encoded text.</p>
51
+ * @public
52
+ */
53
+ tokens: number[] | undefined;
54
+ /**
55
+ * <p>The type of the chunk encoding.</p>
56
+ * @public
57
+ */
58
+ type: EncodedTextChunkType | undefined;
59
+ }
60
+ /**
61
+ * <p>The tokenized model input composed of ordered encoded text chunks.</p>
62
+ * @public
63
+ */
64
+ export interface ModelInput {
65
+ /**
66
+ * <p>The ordered list of encoded text chunks forming the input sequence.</p>
67
+ * @public
68
+ */
69
+ chunks: EncodedTextChunk[] | undefined;
70
+ }
71
+ /**
72
+ * <p>The configuration for computing log-probabilities of prompt tokens without generating new text.</p>
73
+ * @public
74
+ */
75
+ export interface ComputeLogprobsConfig {
76
+ /**
77
+ * <p>The input prompt whose token log-probabilities will be computed.</p>
78
+ * @public
79
+ */
80
+ prompt: ModelInput | undefined;
81
+ /**
82
+ * <p>The ARN of the model package whose checkpoint this operation should run against. Must be a valid SageMaker model package ARN in the format <code>arn:aws:sagemaker:REGION:ACCOUNT:model-package/PACKAGE_NAME/VERSION</code>. When absent, the operation runs against the session's latest checkpoint.</p>
83
+ * @public
84
+ */
85
+ modelPackageArn?: string | undefined;
86
+ }
87
+ /**
88
+ * <p>The result of a compute-logprobs operation.</p>
89
+ * @public
90
+ */
91
+ export interface ComputeLogprobsResult {
92
+ /**
93
+ * <p>The per-token log-probabilities for the input prompt.</p>
94
+ * @public
95
+ */
96
+ logprobs: number[] | undefined;
97
+ }
98
+ /**
99
+ * <p>A tensor with data, data type, and shape metadata.</p>
100
+ * @public
101
+ */
102
+ export interface TensorData {
103
+ /**
104
+ * <p>The raw tensor data as JSON. The format is determined by the <code>dtype</code> field: integer arrays for <code>int64</code>, floating-point arrays for <code>float32</code>.</p>
105
+ * @public
106
+ */
107
+ data: __DocumentType | undefined;
108
+ /**
109
+ * <p>The data type of the tensor elements, such as <code>int64</code> or <code>float32</code>.</p>
110
+ * @public
111
+ */
112
+ dtype: string | undefined;
113
+ /**
114
+ * <p>The dimensions of the tensor, such as [batch_size, seq_length].</p>
115
+ * @public
116
+ */
117
+ shape?: number[] | undefined;
118
+ }
119
+ /**
120
+ * <p>A single training datum containing model input and optional loss function inputs.</p>
121
+ * @public
122
+ */
123
+ export interface Datum {
124
+ /**
125
+ * <p>The tokenized input to feed to the model.</p>
126
+ * @public
127
+ */
128
+ modelInput: ModelInput | undefined;
129
+ /**
130
+ * <p>The tensor inputs for the loss function, keyed by name. Unsupported keys are rejected. Supported keys: <code>target_tokens</code>, <code>weights</code>, <code>advantages</code>, <code>logprobs</code>, <code>ref_log_prob</code>, <code>temperature</code>. Required keys depend on the loss function type: SFT (<code>cross_entropy</code>) requires <code>target_tokens</code> and <code>weights</code>; RL (<code>ppo</code>, <code>cispo</code>, <code>importance_sampling</code>) requires <code>target_tokens</code>, <code>weights</code>, <code>advantages</code>, and <code>logprobs</code>.</p>
131
+ * @public
132
+ */
133
+ lossFnInputs?: Record<string, TensorData> | undefined;
134
+ }
135
+ /**
136
+ * <p>The configuration for loading model weights for inference and sampling without restoring optimizer state.</p>
137
+ * @public
138
+ */
139
+ export interface LoadWeightsForSamplingConfig {
140
+ /**
141
+ * <p>The ARN of the model package containing the weights to load for sampling. Must be a valid SageMaker model package ARN in the format <code>arn:aws:sagemaker:REGION:ACCOUNT:model-package/PACKAGE_NAME/VERSION</code>. The model package must belong to the same AWS account as the training session.</p>
142
+ * @public
143
+ */
144
+ modelPackageArn: string | undefined;
145
+ }
146
+ /**
147
+ * <p>The parameters controlling the text generation sampling strategy.</p>
148
+ * @public
149
+ */
150
+ export interface SamplingParams {
151
+ /**
152
+ * <p>The maximum number of tokens to generate per sample.</p>
153
+ * @public
154
+ */
155
+ maxTokens: number | undefined;
156
+ /**
157
+ * <p>The sampling temperature controlling randomness. Higher values produce more diverse outputs.</p>
158
+ * @public
159
+ */
160
+ temperature?: number | undefined;
161
+ /**
162
+ * <p>The number of highest-probability vocabulary tokens to keep for top-k filtering. Set to -1 to disable.</p>
163
+ * @public
164
+ */
165
+ topK?: number | undefined;
166
+ /**
167
+ * <p>The cumulative probability threshold for nucleus (top-p) sampling. Only tokens with cumulative probability below this threshold are considered.</p>
168
+ * @public
169
+ */
170
+ topP?: number | undefined;
171
+ /**
172
+ * <p>The random seed for reproducible sampling. When set, the same seed with the same input produces deterministic outputs.</p>
173
+ * @public
174
+ */
175
+ seed?: number | undefined;
176
+ /**
177
+ * <p>The list of stop sequences that terminate generation when encountered in the output.</p>
178
+ * @public
179
+ */
180
+ stop?: string[] | undefined;
181
+ }
182
+ /**
183
+ * <p>The configuration for generating text samples from the model.</p>
184
+ * @public
185
+ */
186
+ export interface SampleConfig {
187
+ /**
188
+ * <p>The input prompt to send to the model for text generation.</p>
189
+ * @public
190
+ */
191
+ prompt: ModelInput | undefined;
192
+ /**
193
+ * <p>The number of independent samples to generate for the prompt.</p>
194
+ * @public
195
+ */
196
+ numSamples: number | undefined;
197
+ /**
198
+ * <p>The parameters controlling the sampling strategy.</p>
199
+ * @public
200
+ */
201
+ samplingParams: SamplingParams | undefined;
202
+ /**
203
+ * <p>Specifies whether to include per-token log-probabilities for the input prompt in the response.</p>
204
+ * @public
205
+ */
206
+ includePromptLogprobs?: boolean | undefined;
207
+ /**
208
+ * <p>The number of top-k log-probabilities to return per prompt token.</p>
209
+ * @public
210
+ */
211
+ topkPromptLogprobs?: number | undefined;
212
+ /**
213
+ * <p>The ARN of the model package whose checkpoint this sample should run against. Must be a valid SageMaker model package ARN in the format <code>arn:aws:sagemaker:REGION:ACCOUNT:model-package/PACKAGE_NAME/VERSION</code>. When absent, the sample runs against the session's latest checkpoint.</p>
214
+ * @public
215
+ */
216
+ modelPackageArn?: string | undefined;
217
+ }
218
+ /**
219
+ * <p>The configuration for a sampling operation. Exactly one member must be set to specify the operation type.</p>
220
+ * @public
221
+ */
222
+ export type SampleOperationConfig = SampleOperationConfig.ComputeLogprobsMember | SampleOperationConfig.LoadWeightsForSamplingMember | SampleOperationConfig.SampleMember | SampleOperationConfig.$UnknownMember;
223
+ /**
224
+ * @public
225
+ */
226
+ export declare namespace SampleOperationConfig {
227
+ /**
228
+ * <p>The configuration for generating text samples from the model.</p>
229
+ * @public
230
+ */
231
+ interface SampleMember {
232
+ sample: SampleConfig;
233
+ computeLogprobs?: never;
234
+ loadWeightsForSampling?: never;
235
+ $unknown?: never;
236
+ }
237
+ /**
238
+ * <p>The configuration for computing log-probabilities of prompt tokens without generating new text.</p>
239
+ * @public
240
+ */
241
+ interface ComputeLogprobsMember {
242
+ sample?: never;
243
+ computeLogprobs: ComputeLogprobsConfig;
244
+ loadWeightsForSampling?: never;
245
+ $unknown?: never;
246
+ }
247
+ /**
248
+ * <p>The configuration for loading model weights for inference and sampling without restoring optimizer state.</p>
249
+ * @public
250
+ */
251
+ interface LoadWeightsForSamplingMember {
252
+ sample?: never;
253
+ computeLogprobs?: never;
254
+ loadWeightsForSampling: LoadWeightsForSamplingConfig;
255
+ $unknown?: never;
256
+ }
257
+ /**
258
+ * @public
259
+ */
260
+ interface $UnknownMember {
261
+ sample?: never;
262
+ computeLogprobs?: never;
263
+ loadWeightsForSampling?: never;
264
+ $unknown: [string, any];
265
+ }
266
+ /**
267
+ * @deprecated unused in schema-serde mode.
268
+ *
269
+ */
270
+ interface Visitor<T> {
271
+ sample: (value: SampleConfig) => T;
272
+ computeLogprobs: (value: ComputeLogprobsConfig) => T;
273
+ loadWeightsForSampling: (value: LoadWeightsForSamplingConfig) => T;
274
+ _: (name: string, value: any) => T;
275
+ }
276
+ }
277
+ /**
278
+ * @public
279
+ */
280
+ export interface ExecuteSamplingOperationInput {
281
+ /**
282
+ * <p>The name of the training session to sample from.</p>
283
+ * @public
284
+ */
285
+ trainingSessionName: string | undefined;
286
+ /**
287
+ * <p>The configuration for the sample operation. Specify either a sample configuration to generate text or a computeLogprobs configuration to compute token log-probabilities.</p>
288
+ * @public
289
+ */
290
+ operationConfig: SampleOperationConfig | undefined;
291
+ }
292
+ /**
293
+ * @public
294
+ */
295
+ export interface ExecuteSamplingOperationOutput {
296
+ /**
297
+ * <p>The unique identifier for the submitted sample operation. Use this identifier with <code>GetSamplingOperationResult</code> to retrieve the operation status and result.</p>
298
+ * @public
299
+ */
300
+ operationId: string | undefined;
301
+ }
302
+ /**
303
+ * <p>The configuration for a forward-only pass through the model. This computes loss values without computing gradients.</p>
304
+ * @public
305
+ */
306
+ export interface ForwardConfig {
307
+ /**
308
+ * <p>The name of the loss function to evaluate during the forward pass.</p>
309
+ * @public
310
+ */
311
+ lossFnName: LossFnName | undefined;
312
+ /**
313
+ * <p>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.</p>
314
+ * @public
315
+ */
316
+ datumList: Datum[] | undefined;
317
+ /**
318
+ * <p>Additional loss function configuration passed to the engine. Supported keys are <code>clip_low_threshold</code> (valid range: 0 to 1) and <code>clip_high_threshold</code> (valid range: 1 to 10). Unsupported keys are rejected.</p>
319
+ * @public
320
+ */
321
+ lossFnConfig?: __DocumentType | undefined;
322
+ }
323
+ /**
324
+ * <p>The configuration for a forward and backward pass through the model. This computes both loss values and gradients for use in subsequent optimizer steps.</p>
325
+ * @public
326
+ */
327
+ export interface ForwardBackwardConfig {
328
+ /**
329
+ * <p>The name of the loss function to evaluate during the forward-backward pass.</p>
330
+ * @public
331
+ */
332
+ lossFnName: LossFnName | undefined;
333
+ /**
334
+ * <p>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.</p>
335
+ * @public
336
+ */
337
+ datumList: Datum[] | undefined;
338
+ /**
339
+ * <p>Additional loss function configuration passed to the engine. Supported keys are <code>clip_low_threshold</code> (valid range: 0 to 1) and <code>clip_high_threshold</code> (valid range: 1 to 10). Unsupported keys are rejected.</p>
340
+ * @public
341
+ */
342
+ lossFnConfig?: __DocumentType | undefined;
343
+ }
344
+ /**
345
+ * <p>The configuration for loading training state from a previously saved checkpoint. This restores model weights and optionally optimizer state.</p>
346
+ * @public
347
+ */
348
+ export interface LoadStateConfig {
349
+ /**
350
+ * <p>The ARN of the model package containing the checkpoint to load. Must be a valid SageMaker model package ARN in the format <code>arn:aws:sagemaker:REGION:ACCOUNT:model-package/PACKAGE_NAME/VERSION</code>. Model package group ARNs are not accepted.</p>
351
+ * @public
352
+ */
353
+ modelPackageArn: string | undefined;
354
+ /**
355
+ * <p>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.</p>
356
+ * @public
357
+ */
358
+ loadOptimizer: boolean | undefined;
359
+ }
360
+ /**
361
+ * <p>The configuration for an optimizer step that updates model weights using gradients accumulated from previous forward-backward passes.</p>
362
+ * @public
363
+ */
364
+ export interface OptimizerStepConfig {
365
+ /**
366
+ * <p>The Adam optimizer hyperparameters for this step.</p>
367
+ * @public
368
+ */
369
+ adamParamsConfig: AdamParamsConfig | undefined;
370
+ }
371
+ /**
372
+ * <p>The configuration for saving full training state, including model weights and optimizer state. Use this to create resumable checkpoints.</p>
373
+ * @public
374
+ */
375
+ export interface SaveStateConfig {
376
+ /**
377
+ * <p>A human-readable description for the saved state checkpoint.</p>
378
+ * @public
379
+ */
380
+ description?: string | undefined;
381
+ }
382
+ /**
383
+ * <p>The configuration for saving model weights as a checkpoint.</p>
384
+ * @public
385
+ */
386
+ export interface SaveWeightsConfig {
387
+ /**
388
+ * <p>Specifies whether to merge LoRA adapter weights into the base model before saving. When true, the saved checkpoint contains the full merged model weights.</p>
389
+ * @public
390
+ */
391
+ mergeWeights?: boolean | undefined;
392
+ /**
393
+ * <p>A human-readable description for the saved checkpoint.</p>
394
+ * @public
395
+ */
396
+ description?: string | undefined;
397
+ }
398
+ /**
399
+ * <p>The configuration for a training operation. Exactly one member must be set to specify the operation type and its parameters.</p>
400
+ * @public
401
+ */
402
+ export type OperationConfig = OperationConfig.ForwardMember | OperationConfig.ForwardBackwardMember | OperationConfig.LoadStateMember | OperationConfig.OptimizerStepMember | OperationConfig.SaveStateMember | OperationConfig.SaveWeightsMember | OperationConfig.$UnknownMember;
403
+ /**
404
+ * @public
405
+ */
406
+ export declare namespace OperationConfig {
407
+ /**
408
+ * <p>The configuration for a forward-only pass through the model without gradient computation.</p>
409
+ * @public
410
+ */
411
+ interface ForwardMember {
412
+ forward: ForwardConfig;
413
+ forwardBackward?: never;
414
+ optimizerStep?: never;
415
+ saveWeights?: never;
416
+ saveState?: never;
417
+ loadState?: never;
418
+ $unknown?: never;
419
+ }
420
+ /**
421
+ * <p>The configuration for a forward and backward pass that computes gradients.</p>
422
+ * @public
423
+ */
424
+ interface ForwardBackwardMember {
425
+ forward?: never;
426
+ forwardBackward: ForwardBackwardConfig;
427
+ optimizerStep?: never;
428
+ saveWeights?: never;
429
+ saveState?: never;
430
+ loadState?: never;
431
+ $unknown?: never;
432
+ }
433
+ /**
434
+ * <p>The configuration for an optimizer step that updates model weights using accumulated gradients.</p>
435
+ * @public
436
+ */
437
+ interface OptimizerStepMember {
438
+ forward?: never;
439
+ forwardBackward?: never;
440
+ optimizerStep: OptimizerStepConfig;
441
+ saveWeights?: never;
442
+ saveState?: never;
443
+ loadState?: never;
444
+ $unknown?: never;
445
+ }
446
+ /**
447
+ * <p>The configuration for saving model weights as a checkpoint.</p>
448
+ * @public
449
+ */
450
+ interface SaveWeightsMember {
451
+ forward?: never;
452
+ forwardBackward?: never;
453
+ optimizerStep?: never;
454
+ saveWeights: SaveWeightsConfig;
455
+ saveState?: never;
456
+ loadState?: never;
457
+ $unknown?: never;
458
+ }
459
+ /**
460
+ * <p>The configuration for saving full training state, including model weights and optimizer state.</p>
461
+ * @public
462
+ */
463
+ interface SaveStateMember {
464
+ forward?: never;
465
+ forwardBackward?: never;
466
+ optimizerStep?: never;
467
+ saveWeights?: never;
468
+ saveState: SaveStateConfig;
469
+ loadState?: never;
470
+ $unknown?: never;
471
+ }
472
+ /**
473
+ * <p>The configuration for loading training state from a previously saved checkpoint.</p>
474
+ * @public
475
+ */
476
+ interface LoadStateMember {
477
+ forward?: never;
478
+ forwardBackward?: never;
479
+ optimizerStep?: never;
480
+ saveWeights?: never;
481
+ saveState?: never;
482
+ loadState: LoadStateConfig;
483
+ $unknown?: never;
484
+ }
485
+ /**
486
+ * @public
487
+ */
488
+ interface $UnknownMember {
489
+ forward?: never;
490
+ forwardBackward?: never;
491
+ optimizerStep?: never;
492
+ saveWeights?: never;
493
+ saveState?: never;
494
+ loadState?: never;
495
+ $unknown: [string, any];
496
+ }
497
+ /**
498
+ * @deprecated unused in schema-serde mode.
499
+ *
500
+ */
501
+ interface Visitor<T> {
502
+ forward: (value: ForwardConfig) => T;
503
+ forwardBackward: (value: ForwardBackwardConfig) => T;
504
+ optimizerStep: (value: OptimizerStepConfig) => T;
505
+ saveWeights: (value: SaveWeightsConfig) => T;
506
+ saveState: (value: SaveStateConfig) => T;
507
+ loadState: (value: LoadStateConfig) => T;
508
+ _: (name: string, value: any) => T;
509
+ }
510
+ }
511
+ /**
512
+ * @public
513
+ */
514
+ export interface ExecuteTrainingOperationInput {
515
+ /**
516
+ * <p>The name of the training session to submit the operation to.</p>
517
+ * @public
518
+ */
519
+ trainingSessionName: string | undefined;
520
+ /**
521
+ * <p>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.</p>
522
+ * @public
523
+ */
524
+ sequenceNumber: number | undefined;
525
+ /**
526
+ * <p>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.</p>
527
+ * @public
528
+ */
529
+ clientToken?: string | undefined;
530
+ /**
531
+ * <p>The configuration that specifies the type and parameters of the training operation. Exactly one member of the union must be set.</p>
532
+ * @public
533
+ */
534
+ operationConfig: OperationConfig | undefined;
535
+ }
536
+ /**
537
+ * @public
538
+ */
539
+ export interface ExecuteTrainingOperationOutput {
540
+ /**
541
+ * <p>The unique identifier for the submitted operation. Use this identifier with <code>GetTrainingOperationResult</code> to retrieve the operation status and result.</p>
542
+ * @public
543
+ */
544
+ operationId: string | undefined;
545
+ }
546
+ /**
547
+ * <p>The token usage statistics for training operations.</p>
548
+ * @public
549
+ */
550
+ export interface TrainingTokenUsage {
551
+ /**
552
+ * <p>The number of training tokens consumed by the operation.</p>
553
+ * @public
554
+ */
555
+ trainingTokens?: number | undefined;
556
+ }
557
+ /**
558
+ * <p>The result of a forward and backward pass through the model, including computed gradients.</p>
559
+ * @public
560
+ */
561
+ export interface ForwardBackwardResult {
562
+ /**
563
+ * <p>The data type of the loss function output tensors.</p>
564
+ * @public
565
+ */
566
+ lossFnOutputType?: string | undefined;
567
+ /**
568
+ * <p>The loss function output tensors, keyed by name.</p>
569
+ * @public
570
+ */
571
+ lossFnOutputs?: Record<string, TensorData>[] | undefined;
572
+ /**
573
+ * <p>The training metrics emitted by the engine, such as loss values.</p>
574
+ * @public
575
+ */
576
+ metrics?: Record<string, number> | undefined;
577
+ /**
578
+ * <p>The token usage statistics for metering.</p>
579
+ * @public
580
+ */
581
+ tokenUsage?: TrainingTokenUsage | undefined;
582
+ }
583
+ /**
584
+ * <p>The result of a forward-only pass through the model.</p>
585
+ * @public
586
+ */
587
+ export interface ForwardResult {
588
+ /**
589
+ * <p>The data type of the loss function output tensors.</p>
590
+ * @public
591
+ */
592
+ lossFnOutputType?: string | undefined;
593
+ /**
594
+ * <p>The loss function output tensors, keyed by name.</p>
595
+ * @public
596
+ */
597
+ lossFnOutputs?: Record<string, TensorData>[] | undefined;
598
+ /**
599
+ * <p>The training metrics emitted by the engine, such as loss values.</p>
600
+ * @public
601
+ */
602
+ metrics?: Record<string, number> | undefined;
603
+ /**
604
+ * <p>The token usage statistics for metering.</p>
605
+ * @public
606
+ */
607
+ tokenUsage?: TrainingTokenUsage | undefined;
608
+ }
609
+ /**
610
+ * @public
611
+ */
612
+ export interface GetSamplingOperationResultInput {
613
+ /**
614
+ * <p>The name of the training session that owns the sample operation.</p>
615
+ * @public
616
+ */
617
+ trainingSessionName: string | undefined;
618
+ /**
619
+ * <p>The unique identifier of the sample operation to retrieve, returned by <code>ExecuteSamplingOperation</code>.</p>
620
+ * @public
621
+ */
622
+ operationId: string | undefined;
623
+ }
624
+ /**
625
+ * <p>The result of loading weights for sampling. An empty response indicates success.</p>
626
+ * @public
627
+ */
628
+ export interface LoadWeightsForSamplingResult {
629
+ }
630
+ /**
631
+ * <p>The token usage statistics for a sample generation.</p>
632
+ * @public
633
+ */
634
+ export interface SampleTokenUsage {
635
+ /**
636
+ * <p>The number of tokens in the input prompt (prefill phase).</p>
637
+ * @public
638
+ */
639
+ prefill: number | undefined;
640
+ /**
641
+ * <p>The number of tokens generated (decode phase).</p>
642
+ * @public
643
+ */
644
+ decode: number | undefined;
645
+ }
646
+ /**
647
+ * <p>A single generated sequence from the model.</p>
648
+ * @public
649
+ */
650
+ export interface SampledSequence {
651
+ /**
652
+ * <p>The reason why generation stopped. A value of <code>stop</code> indicates a stop sequence was encountered. A value of <code>length</code> indicates the maximum token limit was reached.</p>
653
+ * @public
654
+ */
655
+ stopReason: StopReason | undefined;
656
+ /**
657
+ * <p>The token IDs of the generated sequence.</p>
658
+ * @public
659
+ */
660
+ tokens: number[] | undefined;
661
+ /**
662
+ * <p>The per-token log-probabilities for the generated tokens.</p>
663
+ * @public
664
+ */
665
+ logprobs?: number[] | undefined;
666
+ /**
667
+ * <p>The token usage statistics for this individual sample.</p>
668
+ * @public
669
+ */
670
+ tokenUsage?: SampleTokenUsage | undefined;
671
+ }
672
+ /**
673
+ * <p>The log-probability for a single token.</p>
674
+ * @public
675
+ */
676
+ export interface TokenLogprob {
677
+ /**
678
+ * <p>The vocabulary token ID.</p>
679
+ * @public
680
+ */
681
+ tokenId: number | undefined;
682
+ /**
683
+ * <p>The log-probability of the token.</p>
684
+ * @public
685
+ */
686
+ logprob: number | undefined;
687
+ }
688
+ /**
689
+ * <p>The response containing generated samples and optional log-probabilities.</p>
690
+ * @public
691
+ */
692
+ export interface SampleResponse {
693
+ /**
694
+ * <p>The list of generated sequences.</p>
695
+ * @public
696
+ */
697
+ sequences: SampledSequence[] | undefined;
698
+ /**
699
+ * <p>The per-token log-probabilities for the input prompt. Populated only when <code>includePromptLogprobs</code> is true.</p>
700
+ * @public
701
+ */
702
+ promptLogprobs?: number[] | undefined;
703
+ /**
704
+ * <p>The top-k log-probabilities per prompt token, as a list of lists. Populated only when <code>topkPromptLogprobs</code> is greater than 0.</p>
705
+ * @public
706
+ */
707
+ topkPromptLogprobs?: TokenLogprob[][] | undefined;
708
+ }
709
+ /**
710
+ * <p>The result of a completed sampling operation. Exactly one member is populated, corresponding to the operation type that was submitted.</p>
711
+ * @public
712
+ */
713
+ export type SampleOperationResult = SampleOperationResult.ComputeLogprobsMember | SampleOperationResult.LoadWeightsForSamplingMember | SampleOperationResult.SampleMember | SampleOperationResult.$UnknownMember;
714
+ /**
715
+ * @public
716
+ */
717
+ export declare namespace SampleOperationResult {
718
+ /**
719
+ * <p>The generated text samples from the model.</p>
720
+ * @public
721
+ */
722
+ interface SampleMember {
723
+ sample: SampleResponse;
724
+ computeLogprobs?: never;
725
+ loadWeightsForSampling?: never;
726
+ $unknown?: never;
727
+ }
728
+ /**
729
+ * <p>The computed log-probabilities for the prompt tokens.</p>
730
+ * @public
731
+ */
732
+ interface ComputeLogprobsMember {
733
+ sample?: never;
734
+ computeLogprobs: ComputeLogprobsResult;
735
+ loadWeightsForSampling?: never;
736
+ $unknown?: never;
737
+ }
738
+ /**
739
+ * <p>The result from loading weights for sampling.</p>
740
+ * @public
741
+ */
742
+ interface LoadWeightsForSamplingMember {
743
+ sample?: never;
744
+ computeLogprobs?: never;
745
+ loadWeightsForSampling: LoadWeightsForSamplingResult;
746
+ $unknown?: never;
747
+ }
748
+ /**
749
+ * @public
750
+ */
751
+ interface $UnknownMember {
752
+ sample?: never;
753
+ computeLogprobs?: never;
754
+ loadWeightsForSampling?: never;
755
+ $unknown: [string, any];
756
+ }
757
+ /**
758
+ * @deprecated unused in schema-serde mode.
759
+ *
760
+ */
761
+ interface Visitor<T> {
762
+ sample: (value: SampleResponse) => T;
763
+ computeLogprobs: (value: ComputeLogprobsResult) => T;
764
+ loadWeightsForSampling: (value: LoadWeightsForSamplingResult) => T;
765
+ _: (name: string, value: any) => T;
766
+ }
767
+ }
768
+ /**
769
+ * @public
770
+ */
771
+ export interface GetSamplingOperationResultOutput {
772
+ /**
773
+ * <p>The current status of the sample operation. Possible values are <code>Pending</code>, <code>InProgress</code>, <code>Completed</code>, or <code>Failed</code>.</p>
774
+ * @public
775
+ */
776
+ status: RequestStatus | undefined;
777
+ /**
778
+ * <p>The result payload of the sample operation. The service populates this field only when the status is <code>Completed</code>.</p>
779
+ * @public
780
+ */
781
+ operationResult?: SampleOperationResult | undefined;
782
+ /**
783
+ * <p>A message describing why the sample operation failed. The service populates this field only when the status is <code>Failed</code>.</p>
784
+ * @public
785
+ */
786
+ errorDetails?: string | undefined;
787
+ }
788
+ /**
789
+ * @public
790
+ */
791
+ export interface GetTrainingOperationResultInput {
792
+ /**
793
+ * <p>The name of the training session that owns the operation.</p>
794
+ * @public
795
+ */
796
+ trainingSessionName: string | undefined;
797
+ /**
798
+ * <p>The unique identifier of the operation to retrieve, returned by <code>ExecuteTrainingOperation</code>.</p>
799
+ * @public
800
+ */
801
+ operationId: string | undefined;
802
+ }
803
+ /**
804
+ * <p>The result of loading training state. An empty response indicates success.</p>
805
+ * @public
806
+ */
807
+ export interface LoadStateResult {
808
+ }
809
+ /**
810
+ * <p>The result of an optimizer step.</p>
811
+ * @public
812
+ */
813
+ export interface OptimizerStepResult {
814
+ /**
815
+ * <p>The training metrics emitted by the engine after the optimizer step.</p>
816
+ * @public
817
+ */
818
+ metrics?: Record<string, number> | undefined;
819
+ }
820
+ /**
821
+ * <p>The result of saving full training state.</p>
822
+ * @public
823
+ */
824
+ export interface SaveStateResult {
825
+ /**
826
+ * <p>The ARN of the model package created for the saved state checkpoint.</p>
827
+ * @public
828
+ */
829
+ modelPackageArn: string | undefined;
830
+ }
831
+ /**
832
+ * <p>The result of saving model weights.</p>
833
+ * @public
834
+ */
835
+ export interface SaveWeightsResult {
836
+ /**
837
+ * <p>The ARN of the model package created for the saved weights.</p>
838
+ * @public
839
+ */
840
+ modelPackageArn?: string | undefined;
841
+ }
842
+ /**
843
+ * <p>The result of a completed training operation. Exactly one member is populated, corresponding to the operation type that was submitted.</p>
844
+ * @public
845
+ */
846
+ export type OperationResult = OperationResult.ForwardMember | OperationResult.ForwardBackwardMember | OperationResult.LoadStateMember | OperationResult.OptimizerStepMember | OperationResult.SaveStateMember | OperationResult.SaveWeightsMember | OperationResult.$UnknownMember;
847
+ /**
848
+ * @public
849
+ */
850
+ export declare namespace OperationResult {
851
+ /**
852
+ * <p>The result from a forward-only pass.</p>
853
+ * @public
854
+ */
855
+ interface ForwardMember {
856
+ forward: ForwardResult;
857
+ forwardBackward?: never;
858
+ optimizerStep?: never;
859
+ saveWeights?: never;
860
+ saveState?: never;
861
+ loadState?: never;
862
+ $unknown?: never;
863
+ }
864
+ /**
865
+ * <p>The result from a forward and backward pass.</p>
866
+ * @public
867
+ */
868
+ interface ForwardBackwardMember {
869
+ forward?: never;
870
+ forwardBackward: ForwardBackwardResult;
871
+ optimizerStep?: never;
872
+ saveWeights?: never;
873
+ saveState?: never;
874
+ loadState?: never;
875
+ $unknown?: never;
876
+ }
877
+ /**
878
+ * <p>The result from an optimizer step.</p>
879
+ * @public
880
+ */
881
+ interface OptimizerStepMember {
882
+ forward?: never;
883
+ forwardBackward?: never;
884
+ optimizerStep: OptimizerStepResult;
885
+ saveWeights?: never;
886
+ saveState?: never;
887
+ loadState?: never;
888
+ $unknown?: never;
889
+ }
890
+ /**
891
+ * <p>The result from saving model weights.</p>
892
+ * @public
893
+ */
894
+ interface SaveWeightsMember {
895
+ forward?: never;
896
+ forwardBackward?: never;
897
+ optimizerStep?: never;
898
+ saveWeights: SaveWeightsResult;
899
+ saveState?: never;
900
+ loadState?: never;
901
+ $unknown?: never;
902
+ }
903
+ /**
904
+ * <p>The result from saving full training state.</p>
905
+ * @public
906
+ */
907
+ interface SaveStateMember {
908
+ forward?: never;
909
+ forwardBackward?: never;
910
+ optimizerStep?: never;
911
+ saveWeights?: never;
912
+ saveState: SaveStateResult;
913
+ loadState?: never;
914
+ $unknown?: never;
915
+ }
916
+ /**
917
+ * <p>The result from loading training state.</p>
918
+ * @public
919
+ */
920
+ interface LoadStateMember {
921
+ forward?: never;
922
+ forwardBackward?: never;
923
+ optimizerStep?: never;
924
+ saveWeights?: never;
925
+ saveState?: never;
926
+ loadState: LoadStateResult;
927
+ $unknown?: never;
928
+ }
929
+ /**
930
+ * @public
931
+ */
932
+ interface $UnknownMember {
933
+ forward?: never;
934
+ forwardBackward?: never;
935
+ optimizerStep?: never;
936
+ saveWeights?: never;
937
+ saveState?: never;
938
+ loadState?: never;
939
+ $unknown: [string, any];
940
+ }
941
+ /**
942
+ * @deprecated unused in schema-serde mode.
943
+ *
944
+ */
945
+ interface Visitor<T> {
946
+ forward: (value: ForwardResult) => T;
947
+ forwardBackward: (value: ForwardBackwardResult) => T;
948
+ optimizerStep: (value: OptimizerStepResult) => T;
949
+ saveWeights: (value: SaveWeightsResult) => T;
950
+ saveState: (value: SaveStateResult) => T;
951
+ loadState: (value: LoadStateResult) => T;
952
+ _: (name: string, value: any) => T;
953
+ }
954
+ }
955
+ /**
956
+ * @public
957
+ */
958
+ export interface GetTrainingOperationResultOutput {
959
+ /**
960
+ * <p>The current status of the operation. Possible values are <code>Pending</code>, <code>InProgress</code>, <code>Completed</code>, <code>Failed</code>, or <code>Skipped</code>.</p>
961
+ * @public
962
+ */
963
+ status: RequestStatus | undefined;
964
+ /**
965
+ * <p>The result payload of the operation. The service populates this field only when the status is <code>Completed</code>. The populated member of the union corresponds to the operation type that was submitted.</p>
966
+ * @public
967
+ */
968
+ operationResult?: OperationResult | undefined;
969
+ /**
970
+ * <p>A message describing why the operation failed. The service populates this field only when the status is <code>Failed</code>.</p>
971
+ * @public
972
+ */
973
+ errorDetails?: string | undefined;
974
+ /**
975
+ * <p>The token usage statistics for metering purposes. The service populates this field for forward and forwardBackward operations upon completion.</p>
976
+ * @public
977
+ */
978
+ tokenUsage?: TrainingTokenUsage | undefined;
979
+ }
980
+ /**
981
+ * @public
982
+ */
983
+ export interface SampleTrainingSessionInput {
984
+ /**
985
+ * <p>The name of the training session whose model to invoke.</p>
986
+ * @public
987
+ */
988
+ trainingSessionName: string | undefined;
989
+ /**
990
+ * <p>The MIME type of the input data in the request body.</p>
991
+ * @public
992
+ */
993
+ contentType?: string | undefined;
994
+ /**
995
+ * <p>The desired MIME type of the inference body in the response.</p>
996
+ * @public
997
+ */
998
+ accept?: string | undefined;
999
+ /**
1000
+ * <p>The ARN of the model package whose checkpoint to invoke.</p>
1001
+ * @public
1002
+ */
1003
+ modelPackageArn?: string | undefined;
1004
+ /**
1005
+ * <p>The raw inference request body.</p>
1006
+ * @public
1007
+ */
1008
+ body?: Uint8Array | undefined;
1009
+ }
1010
+ /**
1011
+ * @public
1012
+ */
1013
+ export interface SampleTrainingSessionOutput {
1014
+ /**
1015
+ * <p>The MIME type of the inference result in the response body.</p>
1016
+ * @public
1017
+ */
1018
+ contentType?: string | undefined;
1019
+ /**
1020
+ * <p>The raw inference response body from the model.</p>
1021
+ * @public
1022
+ */
1023
+ body: Uint8Array | undefined;
1024
+ }
1025
+ /**
1026
+ * @public
1027
+ */
1028
+ export interface SampleTrainingSessionWithResponseStreamInput {
1029
+ /**
1030
+ * <p>The name of the training session whose model to invoke.</p>
1031
+ * @public
1032
+ */
1033
+ trainingSessionName: string | undefined;
1034
+ /**
1035
+ * <p>The MIME type of the input data in the request body.</p>
1036
+ * @public
1037
+ */
1038
+ contentType?: string | undefined;
1039
+ /**
1040
+ * <p>The desired MIME type of the inference body in the response.</p>
1041
+ * @public
1042
+ */
1043
+ accept?: string | undefined;
1044
+ /**
1045
+ * <p>The ARN of the model package whose checkpoint to invoke.</p>
1046
+ * @public
1047
+ */
1048
+ modelPackageArn?: string | undefined;
1049
+ /**
1050
+ * <p>The raw inference request body.</p>
1051
+ * @public
1052
+ */
1053
+ body?: Uint8Array | undefined;
1054
+ }
1055
+ /**
1056
+ * @public
1057
+ */
1058
+ export interface SampleTrainingSessionWithResponseStreamOutput {
1059
+ /**
1060
+ * <p>The MIME type of the streaming inference result.</p>
1061
+ * @public
1062
+ */
1063
+ contentType?: string | undefined;
1064
+ /**
1065
+ * <p>The streaming inference response from the model, delivered as a series of chunks.</p>
1066
+ * @public
1067
+ */
1068
+ body: StreamingBlobTypes | undefined;
1069
+ }