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

Add bf16-mixed and 16-mixed in module.py #7227

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nemo/collections/nlp/modules/common/megatron/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,13 @@ def __init__(self, config: ModelParallelConfig, module, precision, share_token_e
super().__init__(config=config, share_token_embeddings=share_token_embeddings)
self.precision = precision

if precision == 'bf16':
if precision in ['bf16', 'bf16-mixed']:
self.add_module('module', module.bfloat16())

def float16_converter(val):
return val.bfloat16()

elif int(precision) == 16:
elif precision in [16, '16', '16-mixed']:
self.add_module('module', module.half())

def float16_converter(val):
Expand Down
Loading