Skip to content

Commit f4a0340

Browse files
committed
update
1 parent ed340c1 commit f4a0340

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

paddlenlp/transformers/model_utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import numpy as np
2727
import paddle
28+
import paddle.distributed as dist
2829
import paddle.nn as nn
2930
import six
3031
from huggingface_hub import (
@@ -1011,11 +1012,8 @@ def _resolve_model_file_path(
10111012

10121013
# move the `model-name.pdparams` to `model_state.pdparams`
10131014
# get more details from: https://github.com/PaddlePaddle/PaddleNLP/pull/3843
1014-
try:
1015+
if dist.ParallelEnv().local_rank % 8 == 0 and os.path.exists(weight_file_path):
10151016
shutil.move(weight_file_path, new_weight_file_path)
1016-
except FileNotFoundError:
1017-
pass
1018-
10191017
weight_file_path = new_weight_file_path
10201018

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

paddlenlp/utils/downloader.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,7 @@ def _download(url, path, md5sum=None):
233233
for chunk in req.iter_content(chunk_size=1024):
234234
if chunk:
235235
f.write(chunk)
236-
try:
237-
shutil.move(tmp_fullname, fullname)
238-
except FileNotFoundError:
239-
pass
236+
shutil.move(tmp_fullname, fullname)
240237

241238
return fullname
242239

0 commit comments

Comments
 (0)