Skip to content

Commit 4ba16f8

Browse files
committed
Redirect datasets output
1 parent 79868fb commit 4ba16f8

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

docs/source/notebooks/walkthrough.ipynb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,16 @@
158158
}
159159
],
160160
"source": [
161-
"import datasets\n",
161+
"from datasets import load_dataset\n",
162+
"from contextlib import redirect_stdout\n",
162163
"from pprint import pprint\n",
163-
"# Loading a huggingface dataset returns an instance of DatasetDict\n",
164-
"# which contains the dataset splits (usually: train, valid, test) \n",
165-
"imdb = datasets.load_dataset('imdb')\n",
164+
"\n",
165+
"# Silence download logs\n",
166+
"with redirect_stdout(None):\n",
167+
" # Loading a huggingface dataset returns an instance of DatasetDict\n",
168+
" # which contains the dataset splits (usually: train, valid, test) \n",
169+
" imdb = load_dataset('imdb')\n",
170+
"\n",
166171
"print(imdb.keys())\n",
167172
"\n",
168173
"# Each dataset has a set of features which need to be mapped\n",

docs/source/walkthrough.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,16 @@ Converting a dataset from 🤗 datasets into Podium requires some work from your
7373

7474
.. code-block:: python
7575
76-
>>> import datasets
76+
>>> from datasets import load_dataset
77+
>>> from contextlib import redirect_stdout
7778
>>> from pprint import pprint
78-
>>> # Loading a huggingface dataset returns an instance of DatasetDict
79-
>>> # which contains the dataset splits (usually: train, valid, test)
80-
>>> imdb = datasets.load_dataset('imdb')
79+
>>>
80+
>>> # Silence download logs
81+
>>> with redirect_stdout(None):
82+
>>> # Loading a huggingface dataset returns an instance of DatasetDict
83+
>>> # which contains the dataset splits (usually: train, valid, test)
84+
>>> imdb = load_dataset('imdb')
85+
>>>
8186
>>> print(imdb.keys())
8287
dict_keys(['train', 'test', 'unsupervised'])
8388
>>>

0 commit comments

Comments
 (0)