Skip to content

Commit 8d8a42c

Browse files
authored
[BugFix] fix pp eval (#9505)
1 parent a9a6b80 commit 8d8a42c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

paddlenlp/trainer/trainer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,6 +3293,8 @@ def prediction_pipeline_step(
32933293
actual_batch_size = inputs.shape[0]
32943294
model.micro_batch_size = 1
32953295
model.accumulate_steps = actual_batch_size
3296+
# train & eval share the same p2p_helper, so clear it before and after each step
3297+
model._p2p_helper.clear_meta_cache()
32963298

32973299
with paddle.no_grad():
32983300
if has_labels:
@@ -3303,6 +3305,8 @@ def prediction_pipeline_step(
33033305
else:
33043306
raise ValueError("pipeline mode eval need label!")
33053307
model.micro_batch_size, model.accumulate_steps = model_config_backup
3308+
# train & eval share the same p2p_helper, so clear it before and after each step
3309+
model._p2p_helper.clear_meta_cache()
33063310

33073311
return (loss, None, labels)
33083312

0 commit comments

Comments
 (0)