Skip to content

Commit bca0dd5

Browse files
authored
[run_clm.py] fix getting extention
1 parent 5442a11 commit bca0dd5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/language-modeling/run_clm.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,11 @@ def main():
227227
data_files["train"] = data_args.train_file
228228
if data_args.validation_file is not None:
229229
data_files["validation"] = data_args.validation_file
230-
extension = data_args.train_file.split(".")[-1]
230+
extension = (
231+
data_args.train_file.split(".")[-1]
232+
if data_args.train_file is not None
233+
else data_args.validation_file.split(".")[-1]
234+
)
231235
if extension == "txt":
232236
extension = "text"
233237
datasets = load_dataset(extension, data_files=data_files)

0 commit comments

Comments
 (0)