Skip to content

get_code_hash fails when trying to create a TrainStep with a ModelTrainer defined with a source_code #5443

Closed

Description

@mikhailvorobiev1-max

PySDK Version

  • PySDK V2 (2.x)
  • PySDK V3 (3.x)

Describe the bug
A clear and concise description of what the bug is.

When creating a pipeline that contains a TrainStep using a ModelTrainer with a custom source_code defined, running pipeline.definition() or pipeline.upsert() fails.

The error comes from the utilities trying to get the code hash of the executed code and accessing an attribute that does not exist.

To reproduce
A clear, step-by-step set of instructions to reproduce the bug.
The provided code need to be complete and runnable, if additional data is needed, please include them in the issue.

  1. Create a ModelTrainer with the source_code defined
  2. Create a TrainStep using this ModelTrainer.train()
  3. Add the TrainStep to a Pipeline
  4. Upsert pipeline

Expected behavior
A clear and concise description of what you expected to happen.

Pipeline is upserted.

Screenshots or logs
If applicable, add screenshots or logs to help explain your problem.

Image

System information
A description of your system. Please provide:

  • SageMaker Python SDK version: 3.3.0
  • Framework name (eg. PyTorch) or algorithm (eg. KMeans):
  • Framework version:
  • Python version:
  • CPU or GPU:
  • Custom Docker image (Y/N):

Additional context
Add any other context about the problem here.

Activity

  1. mikhailvorobiev1-max commented on Jan 14, 2026

    @mikhailvorobiev1-max
    Author

    Partially fixed with the 3.3.1 release, but now there's some other validation that is failing.
    I've modified the hyperparameter tuning example with a trainstep to showcase the issue:

    Image

    mnist.py
    v3-training-pipeline.ipynb

  2. mohamedzeidan2021 commented on Sep 1, 2026

    @mohamedzeidan2021
    Collaborator

    Both the original error and the follow-up validation failure are fixed.

    A TrainStep built from a ModelTrainer with source_code now hashes correctly through pipeline.definition() / pipeline.upsert(), covered by unit tests. Please upgrade to the current release. Closing as resolved — reopen with a repro if you still see a failure on the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions