torchnlp.download package¶
The torchnlp.download package contains modules useful for donwload and extracting datasets.
-
torchnlp.download.download_file_maybe_extract(url, directory, filename=None, extension=None, check_files=[])[source]¶ Download the file at
urltodirectory. Extract todirectoryif tar or zip.Parameters: - url (str or Path) – Url of file.
- directory (str) – Directory to download to.
- filename (str, optional) – Name of the file to download; Otherwise, a filename is extracted from the url.
- extension (str, optional) – Extension of the file; Otherwise, attempts to extract extension from the filename.
- check_files (list of str or Path) – Check if these files exist, ensuring the download succeeded. If these files exist before the download, the download is skipped.
Returns: Filename of download file.
Return type: (str)
Raises: ValueError– Error if one of thecheck_filesare not found following the download.
-
torchnlp.download.download_files_maybe_extract(urls, directory, check_files=[])[source]¶ Download the files at
urlstodirectory. Extract todirectoryif tar or zip.Parameters: Raises: ValueError– Error if one of thecheck_filesare not found following the download.