Trainer support simultaneously parse JSON files and cmd arguments.#7768
Merged
Conversation
|
Thanks for your contribution! |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #7768 +/- ##
===========================================
- Coverage 57.25% 57.22% -0.04%
===========================================
Files 585 587 +2
Lines 87977 88215 +238
===========================================
+ Hits 50372 50477 +105
- Misses 37605 37738 +133 ☔ View full report in Codecov by Sentry. |
Member
|
需要加到CI脚本中去 |
Contributor
Author
单测文件路径是tests/trainer/test_argparser.py |
ZHUI
requested changes
Jan 8, 2024
ZHUI
reviewed
Jan 8, 2024
ZHUI
reviewed
Jan 8, 2024
Comment on lines
+273
to
+280
| output_dir_arg = next( | ||
| (arg for arg in sys.argv if arg == "--output_dir" or arg.startswith("--output_dir=")), None | ||
| ) | ||
| if output_dir_arg is None: | ||
| if "output_dir" in json_args.keys(): | ||
| sys.argv.extend(["--output_dir", json_args["output_dir"]]) | ||
| else: | ||
| raise ValueError("The following arguments are required: --output_dir") |
Contributor
Author
There was a problem hiding this comment.
如果不特判output_dir,出现json文件里有output_dir参数,但是命令行里没有的情况,执行281行vars(self.parse_args())的时候就会报错,但是我们现在不希望让它报错,所以进行了output_dir的特判
Contributor
There was a problem hiding this comment.
你参考一下这个函数,这个函数也是一样的支持本地文件。
看看这个是怎么处理的。
这个作为通用的parser,在这里做output_dir之类的特判是不太合理的。
JunnYu
pushed a commit
that referenced
this pull request
Jan 22, 2024
…7768) * add parse_json_file_and_cmd_lines * change unit test file path * Change the way the JSON file is determined * Merge parameter parsing judgment branches and add comments. * remove the special handling of output_dir * Add remaining_args warning
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR types
New features
PR changes
LLM
Description
Add functionality to the Trainer to simultaneously parse JSON files and command line arguments.