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

修复bert 1x1下的时间统计bug #171

Merged
merged 1 commit into from
Jul 27, 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
5 changes: 3 additions & 2 deletions training/kunlunxin/bert-pytorch/extern/trainer_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
from torch.cuda.amp import GradScaler
from torch.nn.parallel import DistributedDataParallel as DDP
from torch.optim import Optimizer
from torch_xmlir.optimizer import FusedLAMB

import torch_xmlir
from torch_xmlir.optimizer import FusedLAMB
import torch_xmlir.core.xpu_model as xm

import utils
Expand Down Expand Up @@ -62,7 +63,7 @@ def backward(step: int,
optimizer: Optimizer,
grad_scaler: GradScaler = None):
loss.backward()

torch_xmlir.xpu.xpu_synchronize()
update_step = step % config.gradient_accumulation_steps == 0
if update_step:
update_model_params(loss, optimizer, grad_scaler)
Expand Down