From f9970c83264b43722bd9f97376580cc3dbf61227 Mon Sep 17 00:00:00 2001 From: gdh1995 Date: Tue, 10 Nov 2015 22:41:55 +0800 Subject: [PATCH] fix a bug that time duration may be 0 when downloading model binary --- scripts/download_model_binary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/download_model_binary.py b/scripts/download_model_binary.py index 03a50f6776a..66f72f2477e 100755 --- a/scripts/download_model_binary.py +++ b/scripts/download_model_binary.py @@ -18,7 +18,7 @@ def reporthook(count, block_size, total_size): if count == 0: start_time = time.time() return - duration = time.time() - start_time + duration = (time.time() - start_time) or 0.01 progress_size = int(count * block_size) speed = int(progress_size / (1024 * duration)) percent = int(count * block_size * 100 / total_size)