Skip to content

Issue with half precision training #4913

Merged
wyli merged 1 commit intoProject-MONAI:devfrom
BardiaKh:dev
Aug 16, 2022
Merged

Issue with half precision training #4913
wyli merged 1 commit intoProject-MONAI:devfrom
BardiaKh:dev

Conversation

@BardiaKh
Copy link
Copy Markdown
Contributor

@BardiaKh BardiaKh commented Aug 15, 2022

Fixes potential issues with discrepant data types.
fixes #4914

Description

The attention mask previously was of float type. Now it is changed to the v.dtype to match the input type.

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

fixed potential issue with discrepant data types

Signed-off-by: Bardia Khosravi <[email protected]>
@wyli
Copy link
Copy Markdown
Contributor

wyli commented Aug 15, 2022

thanks, could you please create a small example to report the bug first?

@BardiaKh
Copy link
Copy Markdown
Contributor Author

I opened an issue here.

Copy link
Copy Markdown
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

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

Thanks, it looks good to me. root cause in compute_mask default to float32

img_mask = torch.zeros((1, d, h, w, 1), device=device)

@wyli
Copy link
Copy Markdown
Contributor

wyli commented Aug 15, 2022

/build

@wyli wyli enabled auto-merge (squash) August 15, 2022 22:06
@Nic-Ma Nic-Ma requested a review from tangy5 August 16, 2022 00:26
@Nic-Ma
Copy link
Copy Markdown
Contributor

Nic-Ma commented Aug 16, 2022

Add @tangy5 to help review.

Thanks.

@tangy5
Copy link
Copy Markdown
Contributor

tangy5 commented Aug 16, 2022

Looks good.

@wyli
Copy link
Copy Markdown
Contributor

wyli commented Aug 16, 2022

/build

@wyli wyli merged commit 342f4aa into Project-MONAI:dev Aug 16, 2022
wojiazaiyugang added a commit to wojiazaiyugang/MONAI that referenced this pull request Aug 16, 2022
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.

SwinUNETR: Issue with Half Precision Training

4 participants