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

fix tensor dimensions are not compatible for FP8 issue in sft #8787

Closed
wants to merge 1 commit into from

Conversation

hyxcl
Copy link

@hyxcl hyxcl commented Apr 2, 2024

What does this PR do ?

when we use nemo for sft FP8 training, it will reports
File "/usr/local/lib/python3.10/dist-packages/torch/autograd/function.py", line 289, in apply return user_fn(self, *args) File "/usr/local/lib/python3.10/dist-packages/transformer_engine/pytorch/module/linear.py", line 447, in backward wgrad, _ = fp8_gemm( File "/usr/local/lib/python3.10/dist-packages/transformer_engine/pytorch/cpp_extensions/gemm.py", line 45, in fp8_gemm assert_dim_for_fp8_exec(A) File "/usr/local/lib/python3.10/dist-packages/transformer_engine/pytorch/utils.py", line 221, in assert_dim_for_fp8_exec assert check_dim_for_fp8_exec(tensor), ( AssertionError: Tensor dimensions are not compatible for FP8 execution: (3584 % 8 != 0, 1912 % 16 != 0)

fp8 GEMM requires tensor dimension be multiple of 16. This means the sequence dimension of input data should be padded to multiple of 16, which is not implemented in NeMo chat style data loader yet.​
so need to change
max_length = min(self.max_seq_length, self._ceil_to_nearest(max_length, 8)
to
max_length = min(self.max_seq_length, self._ceil_to_nearest(max_length, 16)
Add a one line overview of what this PR aims to accomplish.

Collection: [Note which collection this PR will affect]

Changelog

  • Add specific line by line info of high level changes in this PR.

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

Jenkins CI

To run Jenkins, a NeMo User with write access must comment jenkins on the PR.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

  • Related to # (issue)

@github-actions github-actions bot added the NLP label Apr 2, 2024
Copy link
Contributor

This PR is stale because it has been open for 14 days with no activity. Remove stale label or comment or update or this will be closed in 7 days.

@github-actions github-actions bot added the stale label Apr 17, 2024
Copy link
Contributor

This PR was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions bot closed this Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant