dmlc--dgl
b0a9d16f25
* [Feature] Add full graph training with dgl built-in dataset. * [Feature] Add full graph training with dgl built-in dataset. * [Feature] Add full graph training with dgl built-in dataset. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Bug] fix model to cuda. * [Feature] Add test loss and accuracy * [Feature] Add test loss and accuracy * [Feature] Add test loss and accuracy * [Feature] Add test loss and accuracy * [Feature] Add test loss and accuracy * [Feature] Add test loss and accuracy * [Fix] Add random * [Bug] Fix batch norm error * [Doc] Test with CN in Sphinx * [Doc] Test with CN in Sphinx * [Doc] Remove the test CN docs. * [Feature] Add input embedding layer * [Feature] Add input embedding layer * [Feature] Add input embedding layer * [Feature] Add input embedding layer * [Feature] Add input embedding layer * [Feature] Add input embedding layer * [Feature] Add input embedding layer * [Feature] Add input embedding layer * [Feature] Add input embedding layer * [Doc] fill readme with new performance results * [Doc] Add Chinese User Guide, graph and 1.5 * [Doc] Add Chinese User Guide, graph and 1.5 * Update README.md * [Fix] Temporary remove compgcn * [Doc] Add CN user guide chapter2 * [Test] Tunning format * [Test] Tunning format * [Test] Tunning format * [Test] Tunning format * [Test] Tunning format * [Test] Section headers * [Fix] Fix format errors * [Fix] Fix format errors * [Fix] Fix format errors * [Doc] Add CN-EN EN-CN links * [Doc] Add CN-EN EN-CN links * [Doc] Copyedit chapter2 * [Doc] Copyedit chapter2 * [Doc] Remove EN in 2.1 * [Doc] Remove EN in chapter 2 * [Doc] Copyedit first 2 sections * [Doc] Copyedit first 2 sections * [Doc] copyedited chapter 2 CN * [Doc] Add chapter 3 raw texts * [Doc] Add chapter 3 preface and 3.1 * [Doc] Add chapter 3.2 and 3.3 * [Doc] Add chapter 3.2 and 3.3 * [Doc] Add chapter 3.2 and 3.3 * [Doc] Remove EN parts * [Doc] Copyediting 3.1 * [Doc] Copyediting 3.2 and 3.3 * [Doc] Proofreading 3.1 and 3.2 * [Doc] Proofreading 3.2 and 3.3 * [Doc] Add chapter 4 CN raw text. * [Clean] Remove codes in other branches * [Doc] Start to copyedit chapter 4 preface * [Doc] copyedit CN section 4.1 * [Doc] Remove EN in User Guide Chapter 4 * [Doc] Copyedit chapter 4.1 * [Doc] copyedit cn chapter 4.2, 4.3, 4.4, and 4.5. * [Doc] Fix errors in EN user guide graph feature and heterograph * [Doc] 2nd round copyediting with Murph's comments * [Doc] 3rd round copyediting with Murph's comments * [Doc] 3rd round copyediting with Murph's comments * [Doc] 3rd round copyediting with Murph's comments * [Sync] syncronize with the dgl master * [Doc] edited after Minjie's comments, 1st round * update cub Co-authored-by: Minjie Wang <wmjlyjemaine@gmail.com>
59 行
2.4 KiB
ReStructuredText
59 行
2.4 KiB
ReStructuredText
.. _guide-data-pipeline-download:
|
|
|
|
4.2 Download raw data (optional)
|
|
--------------------------------
|
|
|
|
:ref:`(中文版) <guide_cn-data-pipeline-download>`
|
|
|
|
If a dataset is already in local disk, make sure it’s in directory
|
|
``raw_dir``. If one wants to run the code anywhere without bothering to
|
|
download and move data to the right directory, one can do it
|
|
automatically by implementing function ``download()``.
|
|
|
|
If the dataset is a zip file, make ``MyDataset`` inherit from
|
|
:class:`dgl.data.DGLBuiltinDataset` class, which handles the zip file extraction for us. Otherwise,
|
|
one needs to implement ``download()`` like in :class:`~dgl.data.QM7bDataset`:
|
|
|
|
.. code::
|
|
|
|
import os
|
|
from dgl.data.utils import download
|
|
|
|
def download(self):
|
|
# path to store the file
|
|
file_path = os.path.join(self.raw_dir, self.name + '.mat')
|
|
# download file
|
|
download(self.url, path=file_path)
|
|
|
|
The above code downloads a .mat file to directory ``self.raw_dir``. If
|
|
the file is a .gz, .tar, .tar.gz or .tgz file, use :func:`~dgl.data.utils.extract_archive`
|
|
function to extract. The following code shows how to download a .gz file
|
|
in :class:`~dgl.data.BitcoinOTCDataset`:
|
|
|
|
.. code::
|
|
|
|
from dgl.data.utils import download, check_sha1
|
|
|
|
def download(self):
|
|
# path to store the file
|
|
# make sure to use the same suffix as the original file name's
|
|
gz_file_path = os.path.join(self.raw_dir, self.name + '.csv.gz')
|
|
# download file
|
|
download(self.url, path=gz_file_path)
|
|
# check SHA-1
|
|
if not check_sha1(gz_file_path, self._sha1_str):
|
|
raise UserWarning('File {} is downloaded but the content hash does not match.'
|
|
'The repo may be outdated or download may be incomplete. '
|
|
'Otherwise you can create an issue for it.'.format(self.name + '.csv.gz'))
|
|
# extract file to directory `self.name` under `self.raw_dir`
|
|
self._extract_gz(gz_file_path, self.raw_path)
|
|
|
|
The above code will extract the file into directory ``self.name`` under
|
|
``self.raw_dir``. If the class inherits from :class:`dgl.data.DGLBuiltinDataset`
|
|
to handle zip file, it will extract the file into directory ``self.name``
|
|
as well.
|
|
|
|
Optionally, one can check SHA-1 string of the downloaded file as the
|
|
example above does, in case the author changed the file in the remote
|
|
server some day.
|