Skip to content

Commit

Permalink
Remove dependency on compat of PaddlePaddle (PaddlePaddle#1486)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghaoshuang authored Nov 1, 2022
1 parent 4a05264 commit 10b8791
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions demo/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.INFO)

DOWNLOAD_RETRY_LIMIT=3
DOWNLOAD_RETRY_LIMIT = 3


def print_arguments(args):
"""Print argparse's arguments.
Expand Down Expand Up @@ -92,7 +93,7 @@ def save_persistable_nodes(executor, dirname, graph):
persistable_nodes = []
all_persistable_nodes = graph.all_persistable_nodes()
for node in all_persistable_nodes:
name = cpt.to_text(node.name())
name = node.name()
if name not in persistable_node_names:
persistable_node_names.add(name)
persistable_nodes.append(node)
Expand Down Expand Up @@ -211,6 +212,7 @@ def _download(url, path, md5sum=None):

return fullname


def _md5check(fullname, md5sum=None):
if md5sum is None:
return True
Expand All @@ -224,10 +226,11 @@ def _md5check(fullname, md5sum=None):

if calc_md5sum != md5sum:
_logger.info("File {} md5 check failed, {}(calc) != "
"{}(base)".format(fullname, calc_md5sum, md5sum))
"{}(base)".format(fullname, calc_md5sum, md5sum))
return False
return True


def _decompress(fname):
"""
Decompress for zip and tar file
Expand Down Expand Up @@ -261,6 +264,7 @@ def _decompress(fname):
shutil.rmtree(fpath_tmp)
os.remove(fname)


def _move_and_merge_tree(src, dst):
"""
Move src directory to dst, if dst is already exists,
Expand Down

0 comments on commit 10b8791

Please sign in to comment.