sagemaker-python-sdk icon indicating copy to clipboard operation
sagemaker-python-sdk copied to clipboard

feature: python module support to torch_distributed

Open clumsy opened this issue 1 year ago • 6 comments

Issue #, if available: Related to https://github.com/aws/sagemaker-training-toolkit/pull/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

  • [x] I have read the CONTRIBUTING doc
  • [x] 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
  • [x] I used the commit message format described in CONTRIBUTING
  • [x] I have passed the region in to all S3 and STS clients that I've initialized as part of this change.
  • [x] I have updated any necessary documentation, including READMEs and API docs (if appropriate)

Tests

  • [x] I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • [x] I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes
  • [x] I have checked that my tests are not configured for a specific region or account (if appropriate)
  • [x] 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.

clumsy avatar Dec 14 '23 17:12 clumsy

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

clumsy avatar Dec 21 '23 23:12 clumsy

AWS CodeBuild CI Report

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

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

mufaddal-rohawala avatar Mar 08 '24 22:03 mufaddal-rohawala

AWS CodeBuild CI Report

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

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

mufaddal-rohawala avatar Mar 08 '24 23:03 mufaddal-rohawala

AWS CodeBuild CI Report

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

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

mufaddal-rohawala avatar Mar 08 '24 23:03 mufaddal-rohawala

AWS CodeBuild CI Report

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

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

mufaddal-rohawala avatar Mar 08 '24 23:03 mufaddal-rohawala

AWS CodeBuild CI Report

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

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

mufaddal-rohawala avatar Mar 08 '24 23:03 mufaddal-rohawala