Skip to content

Commit

Permalink
fix download error multi gpu or multi node (#4491)
Browse files Browse the repository at this point in the history
* fix download error multi gpu or multi node

* update
  • Loading branch information
JunnYu authored Jan 18, 2023
1 parent 82a303f commit 7db00ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions paddlenlp/transformers/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import numpy as np
import paddle
import paddle.distributed as dist
import paddle.nn as nn
import six
from huggingface_hub import (
Expand Down Expand Up @@ -1011,8 +1012,8 @@ def _resolve_model_file_path(

# move the `model-name.pdparams` to `model_state.pdparams`
# get more details from: https://github.com/PaddlePaddle/PaddleNLP/pull/3843
shutil.move(weight_file_path, new_weight_file_path)

if dist.ParallelEnv().local_rank % 8 == 0 and os.path.exists(weight_file_path):
shutil.move(weight_file_path, new_weight_file_path)
weight_file_path = new_weight_file_path

# find the weight file with the above two branch: `bert-base-uncased.pdparams`, `model_state.pdparams`
Expand Down

0 comments on commit 7db00ff

Please sign in to comment.