File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments