Skip to content

Commit 11c5027

Browse files
committed
fix(dgs_corpus): load custom splits
1 parent 4b5666e commit 11c5027

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sign_language_datasets/datasets/dgs_corpus/dgs_corpus.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,16 @@ def load_split(split_name: str) -> Dict[str, str]:
109109
:return:
110110
"""
111111
if split_name not in _KNOWN_SPLITS.keys():
112-
raise ValueError("Split '%s' is not a known data split." % split_name)
112+
if not path.exists(split_name):
113+
raise ValueError("Split '%s' is not a known data split identifier and does not exist as a file either." % split_name)
113114

114-
with open(_KNOWN_SPLITS[split_name]) as infile:
115+
# assume that the supplied string is a path on the file system
116+
split_path = split_name
117+
else:
118+
# the supplied string is an identifier for a predefined split
119+
split_path = _KNOWN_SPLITS[split_name]
120+
121+
with open(split_path) as infile:
115122
split = json.load(infile) # type: Dict[str, str]
116123

117124
return split

0 commit comments

Comments
 (0)