Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: python module support to torch_distributed #4324

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

clumsy
Copy link

@clumsy clumsy commented Dec 14, 2023

Issue #, if available:
Related to aws/sagemaker-training-toolkit#205

Description of changes:

torch_distributed uses torchrun which supports running python modules via -m <MODULE>. Currently SageMaker limits torch_distributed to scripts only. This change will allow submitting the training jobs with sagemaker_program="-m <MODULE>"

Testing done:
Successfully submitted the SageMaker training job with the right parameterss.

The training job will still fail in runtime because sagemaker-training-toolkit need to be updated:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/sagemaker_training/trainer.py", line 88, in train
    entrypoint()
  File "/opt/conda/lib/python3.9/site-packages/sagemaker_pytorch_container/training.py", line 171, in main
    train(environment.Environment())
  File "/opt/conda/lib/python3.9/site-packages/sagemaker_pytorch_container/training.py", line 101, in train
    entry_point.run(uri=training_environment.module_dir,
  File "/opt/conda/lib/python3.9/site-packages/sagemaker_training/entry_point.py", line 93, in run
    install(name=user_entry_point, path=environment.code_dir, capture_error=capture_error)
  File "/opt/conda/lib/python3.9/site-packages/sagemaker_training/entry_point.py", line 126, in install
    os.chmod(os.path.join(path, name), 511)

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

  • I have read the CONTRIBUTING doc
  • I certify that the changes I am introducing will be backward compatible, and I have discussed concerns about this, if any, with the Python SDK team
  • I used the commit message format described in CONTRIBUTING
  • I have passed the region in to all S3 and STS clients that I've initialized as part of this change.
  • I have updated any necessary documentation, including READMEs and API docs (if appropriate)

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes
  • I have checked that my tests are not configured for a specific region or account (if appropriate)
  • I have used unique_name_from_base to create resource names in integ tests (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@rahul003 rahul003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we tested end to end with both toolkit changes and this? Let's make sure toolkit changes are released first

@clumsy
Copy link
Author

clumsy commented Dec 21, 2023

Hi @rahul003, I was able to confirm the fixes work, you're right we need to release toolkit changes first. Thanks!

Copy link
Contributor

@liujiaorr liujiaorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/Bot run all

@mufaddal-rohawala
Copy link
Member

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: 749cd30
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mufaddal-rohawala
Copy link
Member

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-slow-tests
  • Commit ID: 749cd30
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mufaddal-rohawala
Copy link
Member

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-local-mode-tests
  • Commit ID: 749cd30
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mufaddal-rohawala
Copy link
Member

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-notebook-tests
  • Commit ID: 749cd30
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mufaddal-rohawala
Copy link
Member

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: 749cd30
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants