Skip to content
This repository was archived by the owner on Jul 4, 2023. It is now read-only.

Commit a68497e

Browse files
authored
Merge pull request #35 from PetrochukM/general
Small Updates
2 parents 1766cc3 + 875f61e commit a68497e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

torchnlp/download.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def _get_filename_from_url(url):
121121

122122

123123
def download_file_maybe_extract(url, directory, filename=None, extension=None, check_files=[]):
124-
""" Download the file at ``url`` to ``directory``.
124+
""" Download the file at ``url`` to ``directory``. Extract to ``directory`` if tar or zip.
125125
126126
Args:
127127
url (str): Url of file.
@@ -181,7 +181,7 @@ def _check_download(*filepaths):
181181

182182

183183
def download_files_maybe_extract(urls, directory, check_files=[]):
184-
""" Download the files at ``urls`` to ``directory``.
184+
""" Download the files at ``urls`` to ``directory``. Extract to ``directory`` if tar or zip.
185185
186186
Args:
187187
urls (str): Url of files.

torchnlp/word_to_vector/pretrained_word_vectors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ def cache(self, name, cache, url=None):
171171
self.vectors = torch.Tensor(vectors).view(-1, dim)
172172
self.dim = dim
173173
logger.info('Saving vectors to {}'.format(path_pt))
174+
if not os.path.exists(cache):
175+
os.makedirs(cache)
174176
torch.save((self.itos, self.stoi, self.vectors, self.dim), path_pt)
175177
else:
176178
logger.info('Loading vectors from {}'.format(path_pt))

0 commit comments

Comments
 (0)