Replace assertions with ValueError exception (#14142)
Updated masked-language modeling examples in pytorch with convention defined by #12789
This commit is contained in:
@@ -188,10 +188,12 @@ class DataTrainingArguments:
|
||||
else:
|
||||
if self.train_file is not None:
|
||||
extension = self.train_file.split(".")[-1]
|
||||
assert extension in ["csv", "json", "txt"], "`train_file` should be a csv, a json or a txt file."
|
||||
if extension not in ["csv", "json", "txt"]:
|
||||
raise ValueError("`train_file` should be a csv, a json or a txt file.")
|
||||
if self.validation_file is not None:
|
||||
extension = self.validation_file.split(".")[-1]
|
||||
assert extension in ["csv", "json", "txt"], "`validation_file` should be a csv, a json or a txt file."
|
||||
if extension not in ["csv", "json", "txt"]:
|
||||
raise ValueError("`validation_file` should be a csv, a json or a txt file.")
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in New Issue
Block a user