Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kwargs to Dataset.from_generator #5049

Merged
merged 1 commit into from Oct 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/datasets/arrow_dataset.py
Expand Up @@ -936,6 +936,7 @@ def from_generator(
cache_dir: str = None,
keep_in_memory: bool = False,
gen_kwargs: Optional[dict] = None,
**kwargs,
):
"""Create a Dataset from a generator.

Expand All @@ -945,6 +946,7 @@ def from_generator(
cache_dir (:obj:`str`, optional, default ``"~/.cache/huggingface/datasets"``): Directory to cache data.
keep_in_memory (:obj:`bool`, default ``False``): Whether to copy the data in-memory.
gen_kwargs(:obj:`dict`, optional): Keyword arguments to be passed to the `generator` callable.
**kwargs (additional keyword arguments): Keyword arguments to be passed to :class:`GeneratorConfig`.

Returns:
:class:`Dataset`
Expand All @@ -967,6 +969,7 @@ def from_generator(
cache_dir=cache_dir,
keep_in_memory=keep_in_memory,
gen_kwargs=gen_kwargs,
**kwargs,
).read()

@staticmethod
Expand Down