sample_training_session
¶
sample_training_session(
training_session_name: TrainingSessionName,
*,
config_overrides: Optional[SageMakerTrainingSessionRuntimeClientConfig] = None,
content_type: Optional[str] = None,
accept: Optional[str] = None,
model_package_arn: Optional[str] = None,
body: Optional[InferenceBody] = None,
) -> SampleTrainingSessionOutput
Sends an inference request to the model associated with the specified training session and returns the response synchronously. The service passes the request and response bodies to and from the model without modification.
Parameters:
-
training_session_name(TrainingSessionName) –The name of the training session whose model to invoke.
-
content_type(Optional[str], default:None) –The MIME type of the input data in the request body.
-
accept(Optional[str], default:None) –The desired MIME type of the inference body in the response.
-
model_package_arn(Optional[str], default:None) –The ARN of the model package whose checkpoint to invoke.
-
body(Optional[InferenceBody], default:None) –The raw inference request body.
Raises:
-
ConflictException–The training session is in a state that cannot accept new operations. The session must be in
RunningorBlockedstate to accept requests. -
InternalServerException–An internal service error occurred. Retry the request using exponential backoff.
-
ResourceNotFoundException–The specified training session or operation does not exist, or the operation does not belong to the specified training session.
-
ThrottlingException–The request was throttled. Retry the request after a brief wait using exponential backoff.
-
ValidationException–The request is not valid. Check the request syntax and parameters. Examples include invalid sequence numbers, malformed client tokens, missing required fields, or invalid operation configuration.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Sample from a training session Sends a chat completion request to the session's current weights and receives the complete response in a single payload.
>>> client.sample_training_session(training_session_name='my-training-session', content_type='application/json', accept='application/json', body='eyJtZXNzYWdlcyI6W3sicm9sZSI6InVzZXIiLCJjb250ZW50IjoiV2hhdCBpcyB0aGUgY2FwaXRhbCBvZiBGcmFuY2U/In1dLCJtYXhfdG9rZW5zIjoxMjh9')
Source code in docs_src/capo_sagemakertrainingsessionruntime/_services/sage_maker_training_session_runtime.py
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | |