Skip to content

[huggingface_pytorch] Training - update for Transformers to 4.28.1 PyTorch 2.0#2993

Merged
saimidu merged 27 commits into
aws:masterfrom
JingyaHuang:update-hf-pt2.0-train
May 20, 2023
Merged

[huggingface_pytorch] Training - update for Transformers to 4.28.1 PyTorch 2.0#2993
saimidu merged 27 commits into
aws:masterfrom
JingyaHuang:update-hf-pt2.0-train

Conversation

@JingyaHuang

@JingyaHuang JingyaHuang commented May 12, 2023

Copy link
Copy Markdown

GitHub Issue #2986 :

Description

This PR updates Hugginface's PyTorch DLC for inference. Here are the corresponding updated dependencies versions:

  • transformers: 4.28.1
  • datasets: 2.12.0
  • evaluate: 0.4.0
  • accelerate: 0.19.0
  • torch: 2.0.0
  • diffusers: 0.16.1

And extra tests:

  • PyTorch 2.0 compile test
  • Diffusers test

Note:

  • If merging this PR should also close the associated Issue, please also add that Issue # to the Linked Issues section on the right.

  • All PR's are checked weekly for staleness. This PR will be closed if not updated in 30 days.

Description

Tests run

NOTE: By default, docker builds are disabled. In order to build your container, please update dlc_developer_config.toml and specify the framework to build in "build_frameworks"

  • I have run builds/tests on commit for my changes.

NOTE: If you are creating a PR for a new framework version, please ensure success of the standard, rc, and efa sagemaker remote tests by updating the dlc_developer_config.toml file:

  • Revision A: sagemaker_remote_tests = "standard"
  • Revision B: sagemaker_remote_tests = "rc"
  • Revision C: sagemaker_remote_tests = "efa"

Additionally, please run the sagemaker local tests in at least one revision:

  • sagemaker_local_tests = true

Formatting

DLC image/dockerfile

Additional context

PR Checklist

  • I've prepended PR tag with frameworks/job this applies to : [mxnet, tensorflow, pytorch] | [ei/neuron/graviton] | [build] | [test] | [benchmark] | [ec2, ecs, eks, sagemaker]
  • If the PR changes affects SM test, I've modified dlc_developer_config.toml in my PR branch by setting sagemaker_tests = true and efa_tests = true
  • If this PR changes existing code, the change fully backward compatible with pre-existing code. (Non backward-compatible changes need special approval.)
  • (If applicable) I've documented below the DLC image/dockerfile this relates to
  • (If applicable) I've documented below the tests I've run on the DLC image
  • (If applicable) I've reviewed the licenses of updated and new binaries and their dependencies to make sure all licenses are on the Apache Software Foundation Third Party License Policy Category A or Category B license list. See https://www.apache.org/legal/resolved.html.
  • (If applicable) I've scanned the updated and new binaries to make sure they do not have vulnerabilities associated with them.

Pytest Marker Checklist

  • (If applicable) I have added the marker @pytest.mark.model("<model-type>") to the new tests which I have added, to specify the Deep Learning model that is used in the test (use "N/A" if the test doesn't use a model)
  • (If applicable) I have added the marker @pytest.mark.integration("<feature-being-tested>") to the new tests which I have added, to specify the feature that will be tested
  • (If applicable) I have added the marker @pytest.mark.multinode(<integer-num-nodes>) to the new tests which I have added, to specify the number of nodes used on a multi-node test
  • (If applicable) I have added the marker @pytest.mark.processor(<"cpu"/"gpu"/"eia"/"neuron">) to the new tests which I have added, if a test is specifically applicable to only one processor type

EIA/NEURON/GRAVITON Testing Checklist

  • When creating a PR:
  • I've modified dlc_developer_config.toml in my PR branch by setting ei_mode = true, neuron_mode = true or graviton_mode = true

Benchmark Testing Checklist

  • When creating a PR:
  • I've modified dlc_developer_config.toml in my PR branch by setting benchmark_mode = true

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aws-deep-learning-containers-ci aws-deep-learning-containers-ci Bot added build Reflects file change in build folder huggingface Reflects file change in huggingface folder sagemaker_tests Size:S Determines the size of the PR test Reflects file change in test folder labels May 12, 2023
@JingyaHuang JingyaHuang changed the title Update hf pt2.0 train [huggingface_pytorch] Training - update for Transformers to 4.29.1 PyTorch 2.0 May 12, 2023

@saimidu saimidu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should there be another test added for the evaluate feature?

Comment thread huggingface/pytorch/training/docker/2.0/py3/cu118/Dockerfile.gpu Outdated
@JingyaHuang

JingyaHuang commented May 12, 2023

Copy link
Copy Markdown
Author

Should there be another test added for the evaluate feature?

Yep, I replaced previous sklean metrics by those in evaluate. Thanks for the heads up.

@JingyaHuang
JingyaHuang marked this pull request as ready for review May 12, 2023 22:27
@JingyaHuang
JingyaHuang requested a review from a team as a code owner May 12, 2023 22:27
@saimidu

saimidu commented May 13, 2023

Copy link
Copy Markdown

It looks like the diffuser test never ran because of:

TypeError: _test_diffusers_model() missing 1 required positional argument: 'instance_type'

All other sagemaker integration tests for the image failed due to:

AttributeError: 'TrainingArguments' object has no attribute 'distributed_state'

@JingyaHuang JingyaHuang changed the title [huggingface_pytorch] Training - update for Transformers to 4.29.1 PyTorch 2.0 [huggingface_pytorch] Training - update for Transformers to 4.28.1 PyTorch 2.0 May 13, 2023
@JingyaHuang

JingyaHuang commented May 14, 2023

Copy link
Copy Markdown
Author

It looks like the diffuser test never ran because of:

TypeError: _test_diffusers_model() missing 1 required positional argument: 'instance_type'

All other sagemaker integration tests for the image failed due to:

AttributeError: 'TrainingArguments' object has no attribute 'distributed_state'

Hi @saimidu,

The first issue is fixed. For the second issue, sagemaker distributed training features seem broken since the transformers 4.29.* released this week. Let's continue with 4.28.* . I will discuss this break internally with the Transformers team.

Could you help me with the sanity test? Thanks!

@saimidu

saimidu commented May 15, 2023

Copy link
Copy Markdown

@JingyaHuang Thanks for looking into the issues with SM distributed training when using transformers 4.29.*.

One of the failures on the sanity tests is the pip check test that fails because of the installation of tensorflow==2.11.1, which seems to require protobuf<3.20, while the smdebug already installed on the PT 2.0 image requires protobuf>=3.20.0,<=3.20.3. If the version of tensorflow installed is updated to tensorflow==2.12.0, the problem seems to resolve itself. Not sure why the version installed was 2.11.1 instead of 2.12.0, when the latest version is already available.

W.r.t. the second failure, could you add a file named Dockerfile.gpu.os_scan_allowlist.json similar to https://github.com/aws/deep-learning-containers/blob/master/huggingface/tensorflow/training/docker/2.11/py3/cu112/Dockerfile.gpu.os_scan_allowlist.json, which contains the exact dictionary entry for the tf.keras.utils.get_file vulnerability, as printed out in the CI job logs?

@JingyaHuang

JingyaHuang commented May 15, 2023

Copy link
Copy Markdown
Author

Hi @saimidu,

I just pinged the tensorflow to 2.12.0, TF is needed only as a dependency for torch.utils.tensorboard, so we can update it as far as it works with the tensorboard feature, let's see if the CI is green.

For the os_scan_allowlist, it is usually DLC team who takes care of it, maybe @arjkesh could help?

[Update] TensorFlow 2.12.0 is not compatible transformers 4.28.1, maybe we should add TensorFlow lower version the the allow list? As TF is on board just for tensorboard and lower version of TF works for it.

ERROR: Cannot install tensorflow==2.12.0 and transformers[audio,sentencepiece,sklearn,vision]==4.28.1 because these package versions have conflicting dependencies.


The conflict is caused by:
    transformers[audio,sentencepiece,sklearn,vision] 4.28.1 depends on protobuf<=3.20.2; extra == "sentencepiece"
    tensorflow 2.12.0 depends on protobuf!=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <5.0.0dev and >=3.20.3

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

@saimidu

saimidu commented May 17, 2023

Copy link
Copy Markdown

@JingyaHuang All tests seem to pass with tensorflow removed, as per CI on commit 123450d.

Removing tensorflow from ecr-enhanced-scan allowlist and enabling other SM integration tests for the image to move forward.

saimidu
saimidu previously approved these changes May 18, 2023

@saimidu saimidu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved, unless any further changes are necessary. @JingyaHuang Shall we merge this PR?

saimidu
saimidu previously approved these changes May 19, 2023

@saimidu saimidu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PR approved for merge.

@saimidu
saimidu merged commit 54368ae into aws:master May 20, 2023
@JingyaHuang
JingyaHuang deleted the update-hf-pt2.0-train branch May 22, 2023 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Reflects file change in build folder huggingface Reflects file change in huggingface folder Size:S Determines the size of the PR test Reflects file change in test folder

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants