Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#614 from haohongxiang/fix_bugs
Browse files Browse the repository at this point in the history
[GPT] Fix bugs and Add recompute into modeling of single-card
  • Loading branch information
ForFishes committed Aug 9, 2022
2 parents ba371e5 + 4d850ea commit fe4090f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fleetx/models/gpt_model/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from paddle.fluid import layers
from paddle.nn.layer.transformer import _convert_param_attr_to_list
import paddle.incubate as incubate
from paddle.distributed.fleet.utils import recompute
from .config import configurable


Expand Down Expand Up @@ -257,7 +258,8 @@ def forward(self,
cache=cache)
new_caches.append(new_cache)
else:
output = mod(output, memory, tgt_mask, use_cache, cache)
output = recompute(mod, output, memory, tgt_mask, use_cache, cache) if self.use_recompute \
else mod(output, memory, tgt_mask, use_cache, cache)

else:
output, new_cache = mod(output,
Expand Down

0 comments on commit fe4090f

Please sign in to comment.