"examples/vscode:/vscode.git/clone" did not exist on "1500458a073792621a7460abb4e4f6be918dca13"
Unverified Commit 96c3329f authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Fix #6428 (#6437)

parent a8db954c
...@@ -4,7 +4,7 @@ import sys ...@@ -4,7 +4,7 @@ import sys
from argparse import ArgumentParser from argparse import ArgumentParser
from enum import Enum from enum import Enum
from pathlib import Path from pathlib import Path
from typing import Any, Iterable, List, NewType, Tuple, Union from typing import Any, Iterable, List, NewType, Optional, Tuple, Union
DataClass = NewType("DataClass", Any) DataClass = NewType("DataClass", Any)
...@@ -64,7 +64,7 @@ class HfArgumentParser(ArgumentParser): ...@@ -64,7 +64,7 @@ class HfArgumentParser(ArgumentParser):
kwargs["type"] = field.type kwargs["type"] = field.type
if field.default is not dataclasses.MISSING: if field.default is not dataclasses.MISSING:
kwargs["default"] = field.default kwargs["default"] = field.default
elif field.type is bool: elif field.type is bool or field.type is Optional[bool]:
kwargs["action"] = "store_false" if field.default is True else "store_true" kwargs["action"] = "store_false" if field.default is True else "store_true"
if field.default is True: if field.default is True:
field_name = f"--no-{field.name}" field_name = f"--no-{field.name}"
......
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