未验证 提交 88285989 编写于 作者: L LiuHao 提交者: GitHub

fix download.py bugs (#3918)

上级 a4bbb799
......@@ -56,7 +56,7 @@ def download(url, filename):
retry = 0
retry_limit = 3
chunk_size = 4096
while not (os.path.exists(filename):
while not os.path.exists(filename):
if retry < retry_limit:
retry += 1
else:
......@@ -104,17 +104,17 @@ def download_model(dir_path):
if not os.path.exists(dir_path):
os.makedirs(dir_path)
url = BASE_URL + MODEL_NAME
model_path = os.path.join(dir_path, model)
model_path = os.path.join(dir_path, MODEL_NAME)
print("Downloading model: %s" % url)
# download model
download(url, model_path, MODEL_NAME)
download(url, model_path)
# extract model.tar.gz
print("Extracting model: %s" % model_path)
extract(model_path, dir_path)
os.remove(model_path)
if __name__ == "__main__":
if len(sys) != 2:
if len(sys.argv) != 2:
usage()
sys.exit(1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册