Default arguments of clm example are confusing
See original GitHub issueI was having a look at the run_clm.py
script and which new arguments are available to push to the hub.
python transformers\examples\pytorch\language-modeling\run_clm.py -h
I see the following options (note the True defaults for all):
--no_keep_linebreaks Whether to keep line breaks when using TXT files or not. (default: True)
--keep_linebreaks [KEEP_LINEBREAKS]
Whether to keep line breaks when using TXT files or not. (default: True)
--no_dataloader_pin_memory
Whether or not to pin memory for DataLoader. (default: True)
--dataloader_pin_memory [DATALOADER_PIN_MEMORY]
Whether or not to pin memory for DataLoader. (default: True)
--no_skip_memory_metrics
Whether or not to skip adding of memory profiler reports to metrics. (default: True)
--skip_memory_metrics [SKIP_MEMORY_METRICS]
Whether or not to skip adding of memory profiler reports to metrics. (default: True)
From this, I cannot figure out what the default behaviour is or what I should change to become the expected behavior. I do not know what the use case is for this but it seems much better to only keep one of each option. If one the two for each option is deprecated, then that could be added in the description too.
I’m on current master (4.12 dev).
Who can help
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Default function arguments are the devil – Arthur O'Dwyer
Default arguments are defined in one place but evaluated in another. This can lead to confusion about aspects of C++ that are somewhere...
Read more >c++ -- Confusion about using Default Argument - Stack Overflow
Default function arguments must go in the function declaration that the call site sees. int sum (int, int, int = 10);.
Read more >Restrictions on default arguments - IBM
Restrictions on default arguments ... Of the operators, only the function call operator and the operator new can have default arguments when they...
Read more >8.12 — Default arguments - Learn C++
Default arguments are an excellent option when a function needs a value that has a reasonable default value, but for which you want...
Read more >Sonatype CLM for Maven - Nexus IQ Server
You will see references to "Sonatype CLM" in the Maven plugin. We realize this may cause some confusion, and appreciate your patience as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh the code of HfArgumentParser is not visually pleasing so that’s not a problem 😉 If you can suggest a PR, I’ll test on the branch that everything is good with it.
The reason that it is False is because of the order of the arguments. The
no_
variant is added to the argparser first (before the actual argument), therefore its defaults will get precedence down the line. I can make a suggestion in a PR to move things around?That would involve moving this line
https://github.com/huggingface/transformers/blob/3a8de58c5192b620228128430ea52e6eda81c40a/src/transformers/hf_argparser.py#L112-L113
to after this line
https://github.com/huggingface/transformers/blob/3a8de58c5192b620228128430ea52e6eda81c40a/src/transformers/hf_argparser.py#L146
It is not visually as pleasing to repeat the if-clause but I’d argue that it could be worth it when documented well enough.