Skip to content

Commit 6fbb9a0

Browse files
authored
fix the thread problem in taskflow (#817)
1 parent 6b515fd commit 6fbb9a0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

paddlenlp/taskflow/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
Examples:
2323
.. code-block:: python
2424
"""
25+
DOWNLOAD_CHECK = False
2526

2627

2728
def download_file(save_dir, filename, url, md5=None, task=None):
@@ -36,7 +37,12 @@ def download_file(save_dir, filename, url, md5=None, task=None):
3637
url(string): The url downling the file.
3738
md5(string, optional): The md5 value that checking the version downloaded.
3839
"""
39-
DownloaderCheck(task).start()
40+
global DOWNLOAD_CHECK
41+
if not DOWNLOAD_CHECK:
42+
DOWNLOAD_CHECK = True
43+
checker = DownloaderCheck(task)
44+
checker.start()
45+
checker.join()
4046
default_root = os.path.join(MODEL_HOME, save_dir)
4147
fullname = os.path.join(default_root, filename)
4248
if os.path.exists(fullname):

0 commit comments

Comments
 (0)