# Buggy code
def __init__(
    self, verbose=False, path=None, resume=False, searcher_args=None, augment=None
):
    """Initialize the instance.

    The classifier will be loaded from the files in 'path' if parameter 'resume' is True.
    Otherwise it would create a new one.

    Args:
        verbose: A boolean of whether the search process will be printed to stdout.
        path: A string. The path to a directory, where the intermediate results are saved.
        resume: A boolean. If True, the classifier will continue to previous work saved in path.
            Otherwise, the classifier will start a new search.
        augment: A boolean value indicating whether the data needs augmentation. If not define, then it
            will use the value of Constant.DATA_AUGMENTATION which is True by default.

    """
    super().__init__(verbose)

    if searcher_args is None:
        searcher_args = {}

    if path is None:
        path = temp_folder_generator()

    if augment is None:
        augment = Constant.DATA_AUGMENTATION

    self.path = path
    if has_file(os.path.join(self.path, "classifier")) and resume:
        classifier = pickle_from_file(os.path.join(self.path, "classifier"))
        self.__dict__ = classifier.__dict__
    else:
        self.y_encoder = None
        self.data_transformer = None
        self.verbose = verbose
        self.augment = augment
        self.cnn = CnnModule(self.loss, self.metric, searcher_args, path, verbose)


# Traceback (RuntimeError)
╒==============================================╕
|               Training model 1               |
╘==============================================╛
Using TensorFlow backend.
Current Epoch:   0%|                             | 0/1 [00:00<?, ? batch/s]Exception ignored in: <bound method tqdm.__del__ of Current Epoch:   0%|                             | 0/1 [07:59<?, ? batch/s]>
Traceback (most recent call last):
File "/root/anaconda3/envs/automl-formal/lib/python3.6/site-packages/tqdm/_tqdm.py", line 885, in __del__
self.close()
File "/root/anaconda3/envs/automl-formal/lib/python3.6/site-packages/tqdm/_tqdm.py", line 1090, in close
self._decr_instances(self)
File "/root/anaconda3/envs/automl-formal/lib/python3.6/site-packages/tqdm/_tqdm.py", line 454, in _decr_instances
cls.monitor.exit()
File "/root/anaconda3/envs/automl-formal/lib/python3.6/site-packages/tqdm/_monitor.py", line 52, in exit
self.join()
File "/root/anaconda3/envs/automl-formal/lib/python3.6/threading.py", line 1053, in join
raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/root/anaconda3/envs/automl-formal/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/root/anaconda3/envs/automl-formal/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/root/anaconda3/envs/automl-formal/lib/python3.6/site-packages/autokeras/search.py", line 296, in train
verbose=verbose).train_model(**trainer_args)
File "/root/anaconda3/envs/automl-formal/lib/python3.6/site-packages/autokeras/model_trainer.py", line 103, in train_model
self._train()
File "/root/anaconda3/envs/automl-formal/lib/python3.6/site-packages/autokeras/model_trainer.py", line 147, in _train
outputs = self.model(inputs)
File "/root/anaconda3/envs/automl-formal/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "/root/anaconda3/envs/automl-formal/lib/python3.6/site-packages/autokeras/graph.py", line 610, in forward
temp_tensor = torch_layer(edge_input_tensor)
File "/root/anaconda3/envs/automl-formal/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "/root/anaconda3/envs/automl-formal/lib/python3.6/site-packages/torch/nn/modules/batchnorm.py", line 66, in forward
exponential_average_factor, self.eps)
File "/root/anaconda3/envs/automl-formal/lib/python3.6/site-packages/torch/nn/functional.py", line 1254, in batch_norm
training, momentum, eps, torch.backends.cudnn.enabled
RuntimeError: $ Torch: not enough memory: you tried to allocate 0GB. Buy new RAM! at [/pytorch/aten/src/TH/THGeneral.cpp:204]

# Fixed code
def __init__(
    self, verbose=False, path=None, resume=False, searcher_args=None, augment=None
):
    """Initialize the instance.

    The classifier will be loaded from the files in 'path' if parameter 'resume' is True.
    Otherwise it would create a new one.

    Args:
        verbose: A boolean of whether the search process will be printed to stdout.
        path: A string. The path to a directory, where the intermediate results are saved.
        resume: A boolean. If True, the classifier will continue to previous work saved in path.
            Otherwise, the classifier will start a new search.
        augment: A boolean value indicating whether the data needs augmentation. If not define, then it
            will use the value of Constant.DATA_AUGMENTATION which is True by default.

    """
    super().__init__(verbose)

    if searcher_args is None:
        searcher_args = {}

    if path is None:
        path = temp_folder_generator()

    if augment is None:
        augment = Constant.DATA_AUGMENTATION

    self.path = path
    if has_file(os.path.join(self.path, "classifier")) and resume:
        classifier = pickle_from_file(os.path.join(self.path, "classifier"))
        self.__dict__ = classifier.__dict__
    else:
        self.y_encoder = None
        self.data_transformer = None
        self.verbose = verbose
        self.augment = augment
        self.cnn = CnnModule(self.loss, self.metric, searcher_args, path, verbose)

    self.resize_height = None
    self.resize_width = None