MCPcopy Index your code
hub / github.com/lisa-lab/DeepLearningTutorials / get_dataset_file

Function get_dataset_file

code/imdb.py:54–79  ·  view source on GitHub ↗

Look for it as if it was a full path, if not, try local file, if not try in the data directory. Download dataset if it is not present

(dataset, default_dataset, origin)

Source from the content-addressed store, hash-verified

52
53
54def get_dataset_file(dataset, default_dataset, origin):
55 '''Look for it as if it was a full path, if not, try local file,
56 if not try in the data directory.
57
58 Download dataset if it is not present
59
60 '''
61 data_dir, data_file = os.path.split(dataset)
62 if data_dir == "" and not os.path.isfile(dataset):
63 # Check if dataset is in the data directory.
64 new_path = os.path.join(
65 os.path.split(__file__)[0],
66 "..",
67 "data",
68 dataset
69 )
70 if os.path.isfile(new_path) or data_file == default_dataset:
71 dataset = new_path
72
73 if (not os.path.isfile(dataset)) and data_file == default_dataset:
74 from six.moves import urllib
75 print('Downloading data from %s' % origin)
76 urllib.request.urlretrieve(origin, dataset)
77
78
79 return dataset
80
81
82def load_data(path="imdb.pkl", n_words=100000, valid_portion=0.1, maxlen=None,

Callers 1

load_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected