Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
haifeng-jin committed Aug 20, 2018
1 parent b312010 commit 9e2d8b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion autokeras/image_supervised.py
Expand Up @@ -241,10 +241,12 @@ def fit(self, x_train=None, y_train=None, time_limit=None):
time_elapsed = time.time() - start_time
time_remain = time_limit - time_elapsed
# if no search executed during the time_limit, then raise an error
if time_remain <= 0:
raise TimeoutError
except TimeoutError:
if len(self.load_searcher().history) == 0:
raise TimeoutError("Search Time too short. No model was found during the search time.")
else:
elif self.verbose:
print('Time is out.')

@abstractmethod
Expand Down
3 changes: 2 additions & 1 deletion tests/test_image_supervised.py
Expand Up @@ -54,7 +54,8 @@ def test_fit_predict(_):

@patch('multiprocessing.Pool', new=MockProcess)
def test_timeout():
Constant.MAX_MODEL_NUM = 4
# Constant.MAX_MODEL_NUM = 4
Constant.SEARCH_MAX_ITER = 1000
Constant.T_MIN = 0.8
Constant.DATA_AUGMENTATION = False
path = 'tests/resources/temp'
Expand Down

0 comments on commit 9e2d8b9

Please sign in to comment.