Skip to content

Commit

Permalink
Fix clear gradient of OFA-bert (PaddlePaddle#77)
Browse files Browse the repository at this point in the history
* fix clear gradient

* update readme
  • Loading branch information
ceci3 authored Mar 8, 2021
1 parent 2edaba0 commit a5116de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/model_compression/ofa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ BERT-base模型是一个迁移能力很强的通用语义表示模型,但是
首先需要对Pretrain-Model在实际的下游任务上进行Finetuning,得到需要压缩的模型。

```shell
cd ../../glue/
cd ../../benchmark/glue/
```

```python
Expand Down
2 changes: 1 addition & 1 deletion examples/model_compression/ofa/run_glue_ofa.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def do_train(args):
loss.backward()
optimizer.step()
lr_scheduler.step()
ofa_model.model.clear_grad()
optimizer.clear_grad()

if global_step % args.logging_steps == 0:
if (not args.n_gpu > 1) or paddle.distributed.get_rank() == 0:
Expand Down

0 comments on commit a5116de

Please sign in to comment.