Skip to content

Commit

Permalink
Redirect datasets output
Browse files Browse the repository at this point in the history
  • Loading branch information
mariosasko committed Apr 1, 2021
1 parent 79868fb commit 4ba16f8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
13 changes: 9 additions & 4 deletions docs/source/notebooks/walkthrough.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,16 @@
}
],
"source": [
"import datasets\n",
"from datasets import load_dataset\n",
"from contextlib import redirect_stdout\n",
"from pprint import pprint\n",
"# Loading a huggingface dataset returns an instance of DatasetDict\n",
"# which contains the dataset splits (usually: train, valid, test) \n",
"imdb = datasets.load_dataset('imdb')\n",
"\n",
"# Silence download logs\n",
"with redirect_stdout(None):\n",
" # Loading a huggingface dataset returns an instance of DatasetDict\n",
" # which contains the dataset splits (usually: train, valid, test) \n",
" imdb = load_dataset('imdb')\n",
"\n",
"print(imdb.keys())\n",
"\n",
"# Each dataset has a set of features which need to be mapped\n",
Expand Down
13 changes: 9 additions & 4 deletions docs/source/walkthrough.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ Converting a dataset from 🤗 datasets into Podium requires some work from your

.. code-block:: python
>>> import datasets
>>> from datasets import load_dataset
>>> from contextlib import redirect_stdout
>>> from pprint import pprint
>>> # Loading a huggingface dataset returns an instance of DatasetDict
>>> # which contains the dataset splits (usually: train, valid, test)
>>> imdb = datasets.load_dataset('imdb')
>>>
>>> # Silence download logs
>>> with redirect_stdout(None):
>>> # Loading a huggingface dataset returns an instance of DatasetDict
>>> # which contains the dataset splits (usually: train, valid, test)
>>> imdb = load_dataset('imdb')
>>>
>>> print(imdb.keys())
dict_keys(['train', 'test', 'unsupervised'])
>>>
Expand Down

0 comments on commit 4ba16f8

Please sign in to comment.