mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Don't use store_xxx
on optional bools (#7786)
* Don't use `store_xxx` on optional bools * Refine test * Refine test
This commit is contained in:
parent
a1d1b332d0
commit
bb9559a7f9
@ -59,7 +59,7 @@ class TorchXLAExamplesTests(unittest.TestCase):
|
||||
--model_name_or_path=bert-base-cased
|
||||
--per_device_train_batch_size=64
|
||||
--per_device_eval_batch_size=64
|
||||
--evaluate_during_training
|
||||
--evaluation_strategy steps
|
||||
--overwrite_cache
|
||||
""".split()
|
||||
with patch.object(sys, "argv", testargs):
|
||||
|
@ -43,7 +43,7 @@ python run_tf_text_classification.py \
|
||||
--do_eval \
|
||||
--do_predict \
|
||||
--logging_steps 10 \
|
||||
--evaluate_during_training \
|
||||
--evaluation_strategy steps \
|
||||
--save_steps 10 \
|
||||
--overwrite_output_dir \
|
||||
--max_seq_length 128
|
||||
|
@ -65,7 +65,8 @@ class HfArgumentParser(ArgumentParser):
|
||||
if field.default is not dataclasses.MISSING:
|
||||
kwargs["default"] = field.default
|
||||
elif field.type is bool or field.type is Optional[bool]:
|
||||
kwargs["action"] = "store_false" if field.default is True else "store_true"
|
||||
if field.type is bool or (field.default is not None and field.default is not dataclasses.MISSING):
|
||||
kwargs["action"] = "store_false" if field.default is True else "store_true"
|
||||
if field.default is True:
|
||||
field_name = f"--no-{field.name}"
|
||||
kwargs["dest"] = field.name
|
||||
|
@ -191,7 +191,7 @@ class TrainingArguments:
|
||||
do_eval: bool = field(default=None, metadata={"help": "Whether to run eval on the dev set."})
|
||||
do_predict: bool = field(default=False, metadata={"help": "Whether to run predictions on the test set."})
|
||||
evaluate_during_training: bool = field(
|
||||
default=None,
|
||||
default=False,
|
||||
metadata={"help": "Run evaluation during training at each logging step."},
|
||||
)
|
||||
evaluation_strategy: EvaluationStrategy = field(
|
||||
|
@ -85,7 +85,7 @@
|
||||
pass-as: --output_dir={v}
|
||||
type: string
|
||||
default: /valohai/outputs
|
||||
- name: evaluate_during_training
|
||||
description: Run evaluation during training at each logging step.
|
||||
type: flag
|
||||
default: true
|
||||
- name: evaluation_strategy
|
||||
description: The evaluation strategy to use.
|
||||
type: string
|
||||
default: steps
|
||||
|
Loading…
Reference in New Issue
Block a user