Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,8 @@ def _comm_and_clip(
)
clip_var_fp16 = paddle.cast(clip_var, paddle.float16)

# bf16 is not supported on XPU now
if not (
paddle.is_compiled_with_xpu()
or isinstance(
paddle.framework._current_expected_place(), paddle.CustomPlace
)
if not isinstance(
paddle.framework._current_expected_place(), paddle.CustomPlace
):
clip_var_bf16 = paddle.cast(clip_var, paddle.bfloat16)
for p, g in params_grads:
Expand All @@ -249,10 +245,6 @@ def _comm_and_clip(
if g.dtype == paddle.float16:
g.multiply_(clip_var_fp16)
elif g.dtype == paddle.bfloat16:
if paddle.is_compiled_with_xpu():
raise NotImplementedError(
"BF16 is not supported on XPU now"
)
g.multiply_(clip_var_bf16)
else:
g.multiply_(clip_var)
Expand Down