Unverified Commit cdf19c50 authored by Nicolas Patry's avatar Nicolas Patry Committed by GitHub
Browse files

Re-export `KeyDataset`. (#15645)

* Re-export `KeyDataset`.

* Update the docs locations.
parent 28e6155d
......@@ -78,7 +78,7 @@ GPU. If it doesn't don't hesitate to create an issue.
```python
import datasets
from transformers import pipeline
from transformers.pipelines.base import KeyDataset
from transformers.pipelines.pt_utils import KeyDataset
from tqdm.auto import tqdm
pipe = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-960h", device=0)
......@@ -128,7 +128,7 @@ whenever the pipeline uses its streaming ability (so when passing lists or `Data
```python
from transformers import pipeline
from transformers.pipelines.base import KeyDataset
from transformers.pipelines.pt_utils import KeyDataset
import datasets
dataset = datasets.load_dataset("imdb", name="plain_text", split="unsupervised")
......
......@@ -118,7 +118,7 @@ Next, load a dataset (see the 🤗 Datasets [Quick Start](https://huggingface.co
Now you can iterate over the dataset with the pipeline. `KeyDataset` retrieves the item in the dictionary returned by the dataset:
```py
>>> from transformers.pipelines.base import KeyDataset
>>> from transformers.pipelines.pt_utils import KeyDataset
>>> from tqdm.auto import tqdm
>>> for out in tqdm(speech_recognizer(KeyDataset(dataset, "file"))):
......
......@@ -49,6 +49,9 @@ if is_torch_available():
from torch.utils.data import DataLoader, Dataset
from ..models.auto.modeling_auto import AutoModel
# Re-export for backward compatibility
from .pt_utils import KeyDataset
else:
Dataset = None
KeyDataset = None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment