tiny fix about badam

This commit is contained in:
hiyouga
2024-06-25 01:54:53 +08:00
parent efb81b25ec
commit 095fab58d3
17 changed files with 31 additions and 102 deletions

View File

@@ -72,7 +72,8 @@ class PairwiseTrainer(Trainer):
self.processor = processor
self.can_return_loss = True # override property to return eval_loss
if finetuning_args.use_badam:
from badam import clip_grad_norm_old_version, BAdamCallback
from badam import BAdamCallback, clip_grad_norm_old_version
self.accelerator.clip_grad_norm_ = MethodType(clip_grad_norm_old_version, self.accelerator)
self.callback_handler.add_callback(BAdamCallback)