Skip to content

Commit

Permalink
[MRG] Tqdm googcolab, Resolve #307 (#343)
Browse files Browse the repository at this point in the history
* Change Process.Pool to subprocess to be compatible with google colab

* Add docstring for model_trainer and preprocessor

* Replace tqdm.notebook to tqdm for googcolab
  • Loading branch information
tl-yang authored and haifeng-jin committed Nov 26, 2018
1 parent 847c194 commit 0daf415
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion autokeras/nn/model_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
import torch
from torchvision import utils as vutils
from tqdm.autonotebook import tqdm
from tqdm import tqdm
from autokeras.constant import Constant
from autokeras.utils import get_device

Expand Down
3 changes: 3 additions & 0 deletions autokeras/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def __call__(self, img):

class DataTransformer(ABC):
"""A superclass for all the DataTransformer."""

def __init__(self):
pass

Expand Down Expand Up @@ -140,6 +141,7 @@ def text_transform(compose_list, data, targets):

class TextDataTransformer(DataTransformer):
""" A DataTransformer class for the text data."""

def __init__(self):
super().__init__()

Expand Down Expand Up @@ -303,6 +305,7 @@ def __len__(self):

class BatchDataset(Dataset):
"""A torch.Dataset class that can read data batch by batch."""

def __init__(self, csv_file_path, image_path, has_target=True):
file_names, target = read_csv_file(csv_file_path)

Expand Down
2 changes: 1 addition & 1 deletion autokeras/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def pickle_to_file(obj, path):
"""Save the pickle file to the specified path."""
pickle.dump(obj, open(path, 'wb'))


# TODO cannot detect nvidia-smi in Windows normally. We need a fall back for windows
def get_device():
""" If CUDA is available, use CUDA device, else use CPU device.
Expand Down

0 comments on commit 0daf415

Please sign in to comment.