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

support cpm on xpu #76

Merged
merged 9 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
support cpm on xpu
  • Loading branch information
Feilei Du committed May 17, 2023
commit c534e117f60903f233ca2196c7864118183e25c8
2 changes: 1 addition & 1 deletion training/kunlunxin/cpm-pytorch/config/config_R300x1x8.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
max_steps = 10000

warmup = 0.2
learning_rate = 0.000125
learning_rate = 0.0005

beta_1: float = 0.9
Copy link
Contributor

@yuzhou03 yuzhou03 May 18, 2023

Choose a reason for hiding this comment

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

beta_1, beta_2, eps值没有改变的,可以删除。

beta_2: float = 0.99
Expand Down
19 changes: 1 addition & 18 deletions training/kunlunxin/cpm-pytorch/extern/trainer_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,6 @@ def create_optimizer(config, model):

return optimizer

class Wrap_Module(nn.Module):

def __init__(self, module):
super(Wrap_Module, self).__init__()
self.add_module('module', module)

def forward(self, *inputs, **kwargs):
return self.module(*inputs, **kwargs)

def state_dict(self, destination=None, prefix='', keep_vars=False):
return self.module.state_dict(destination, prefix, keep_vars)

def load_state_dict(self, state_dict, strict=True):
self.module.load_state_dict(state_dict, strict=strict)

def model_to_fp16(config, model: nn.Module,
optimizer: Optimizer) -> Tuple[nn.Module, Optimizer]:
# we don't support fp16 now, but we should follow the FP16_Module behavior
model = Wrap_Module(model)
return model, optimizer
return model, optimizer