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

Commit

Permalink
Merge pull request #35 from PetrochukM/general
Browse files Browse the repository at this point in the history
Small Updates
  • Loading branch information
PetrochukM committed May 6, 2018
2 parents 1766cc3 + 875f61e commit a68497e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torchnlp/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _get_filename_from_url(url):


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


def download_files_maybe_extract(urls, directory, check_files=[]):
""" Download the files at ``urls`` to ``directory``.
""" Download the files at ``urls`` to ``directory``. Extract to ``directory`` if tar or zip.
Args:
urls (str): Url of files.
Expand Down
2 changes: 2 additions & 0 deletions torchnlp/word_to_vector/pretrained_word_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ def cache(self, name, cache, url=None):
self.vectors = torch.Tensor(vectors).view(-1, dim)
self.dim = dim
logger.info('Saving vectors to {}'.format(path_pt))
if not os.path.exists(cache):
os.makedirs(cache)
torch.save((self.itos, self.stoi, self.vectors, self.dim), path_pt)
else:
logger.info('Loading vectors from {}'.format(path_pt))
Expand Down

0 comments on commit a68497e

Please sign in to comment.