Skip to content

Commit 218db9a

Browse files
authored
custom intent split name (#238)
1 parent b1e27e1 commit 218db9a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

autointent/_dataset/_dataset.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,19 @@ def from_json(cls, filepath: str | Path) -> "Dataset":
9494
return JsonReader().read(filepath)
9595

9696
@classmethod
97-
def from_hub(cls, repo_name: str) -> "Dataset":
97+
def from_hub(cls, repo_name: str, intent_subset_name: str = Split.INTENTS) -> "Dataset":
9898
"""Loads a dataset from the Hugging Face Hub.
9999
100100
Args:
101101
repo_name: The name of the Hugging Face repository, like `DeepPavlov/clinc150`.
102+
intent_subset_name: The name of the intent subset to load, defaults to `intents`.
102103
"""
103104
from ._reader import DictReader
104105

105106
splits = load_dataset(repo_name, "default")
106107
mapping = dict(**splits)
107-
if Split.INTENTS in get_dataset_config_names(repo_name):
108-
mapping["intents"] = load_dataset(repo_name, Split.INTENTS)[Split.INTENTS].to_list()
108+
if intent_subset_name in get_dataset_config_names(repo_name):
109+
mapping[Split.INTENTS] = load_dataset(repo_name, intent_subset_name, split=Split.INTENTS).to_list()
109110

110111
return DictReader().read(mapping)
111112

0 commit comments

Comments
 (0)