From f6fd608ead722ca970d8bfc8cbd9a07f11b9507c Mon Sep 17 00:00:00 2001 From: Yuchen Zhong Date: Sun, 10 May 2020 12:00:26 +0800 Subject: [PATCH] hotfix: use concurrent.futures.Timeout (#8) * hotfix: fix timeout typo * hotfix: test timeout * hotfix: set timeout 0.1s --- byteps/mxnet/__init__.py | 3 --- byteps/mxnet/compression.py | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/byteps/mxnet/__init__.py b/byteps/mxnet/__init__.py index e880f150e..9c14c9f92 100644 --- a/byteps/mxnet/__init__.py +++ b/byteps/mxnet/__init__.py @@ -230,9 +230,6 @@ def __init__(self, params, optimizer, optimizer_params=None, root_rank=0, compre ) byteps_declare_tensor("gradient_" + str(i), **byteps_params) - def __del__(self): - self._f.close() - def _register_compressor(self, params, optimizer_params, compression_params): """Register compressor for BytePS diff --git a/byteps/mxnet/compression.py b/byteps/mxnet/compression.py index fd90f2cb3..fab9a8ff6 100644 --- a/byteps/mxnet/compression.py +++ b/byteps/mxnet/compression.py @@ -105,8 +105,8 @@ def decompress(self, tensor, ctx, *args, **kwargs): try: self.future.result(timeout=0.1) tensor += self.cache - except TimeoutError: - print("timeout") + except concurrent.futures.TimeoutError: + print("timeout for wd-momentum") return self.compressor.decompress(tensor, ctx)