"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "30c172fc203add539d5e08393c0c6c7a2fbc6a71"
Unverified Commit 7af55d3a authored by David del Río Medina's avatar David del Río Medina Committed by GitHub
Browse files

Replace assertion with ValueError exception (#14098)

parent f00bceab
......@@ -133,9 +133,8 @@ class HfArgumentParser(ArgumentParser):
):
kwargs["nargs"] = "+"
kwargs["type"] = field.type.__args__[0]
assert all(
x == kwargs["type"] for x in field.type.__args__
), f"{field.name} cannot be a List of mixed types"
if not all(x == kwargs["type"] for x in field.type.__args__):
raise ValueError(f"{field.name} cannot be a List of mixed types")
if field.default_factory is not dataclasses.MISSING:
kwargs["default"] = field.default_factory()
elif field.default is dataclasses.MISSING:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment