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

SageMaker DP Support #494

Merged

Conversation

pacman100
Copy link
Contributor

@pacman100 pacman100 commented Jul 7, 2022

What does this PR do?

  1. Fixes bugs in the current SageMaker support to get it working properly using the latest HF DLC
  2. Adds DATA_PARALLEL support. Run accelerate config and answer the questions and choose DATA_PARALLEL for SageMaker Distribution Type. Sample config below with XXXXX values being AWS account specific.
base_job_name: accelerate-sagemaker-1
compute_environment: AMAZON_SAGEMAKER
distributed_type: DATA_PARALLEL
ec2_instance_type: ml.p3.16xlarge
iam_role_name: XXXXX
mixed_precision: fp16
num_machines: 1
profile: XXXXX
py_version: py38
pytorch_version: 1.10.2
region: us-east-1
transformers_version: 4.17.0
use_cpu: false

After above config, just run the below command to run the official NLP example:

cd acceelerate/examples
accelerate launch complete_nlp_example.py

The output logs:

Screenshot 2022-07-08 at 1 55 52 AM

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jul 7, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Looking good at first glance! Let's focus on DataParallel only as AWS told us they were completely changing the API for model parallelism.

@pacman100 pacman100 changed the title SageMaker DP and MP Support SageMaker DP Support Jul 7, 2022
@pacman100 pacman100 marked this pull request as ready for review July 7, 2022 20:46
@pacman100 pacman100 requested a review from sgugger July 7, 2022 20:47
Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! Let's also see what @philschmid thinks since he worked on the sagemaker command in Accelerate.

src/accelerate/state.py Outdated Show resolved Hide resolved
@pacman100 pacman100 requested a review from philschmid July 7, 2022 20:59
@plamb-viso
Copy link

I will test this with my use case as soon as it gets merged into main

Copy link
Contributor

@philschmid philschmid left a comment

Choose a reason for hiding this comment

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

LGTM! How should we maintain the SAGEMAKER_PYTHON_VERSION, SAGEMAKER_PYTORCH_VERSION, SAGEMAKER_TRANSFORMERS_VERSION versions once we release new DLCs?

@pacman100
Copy link
Contributor Author

LGTM! How should we maintain the SAGEMAKER_PYTHON_VERSION, SAGEMAKER_PYTORCH_VERSION, SAGEMAKER_TRANSFORMERS_VERSION versions once we release new DLCs?

Hello, as it is not a frequent change, it can be done manually for time being whenever new releases of DLC happen. Any suggestions/best practices for automating it?

@pacman100 pacman100 merged commit a0514dd into huggingface:main Jul 8, 2022
@HebaGamalElDin
Copy link

Hello @pacman100, what is the sagemaker SDK estimator supposed to be used with accelerate?

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.

6 participants