Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support customize config path #423

Merged
merged 3 commits into from
Sep 22, 2023

Conversation

chenbohua3
Copy link
Contributor

@chenbohua3 chenbohua3 commented Sep 20, 2023

If the config path can be customized, then when other projects introduce opencompass, they can maintain their own datasets/models configuration in their own projects:)

Copy link
Collaborator

@gaotongxiao gaotongxiao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! The linting test seems not passed.

image

You can install pre-commit hooks to automatically fix this issue:

pip install -U pre-commit
pre-commit install
pre-commit run --all-files
git add --update
git commit

run.py Outdated
@@ -82,6 +82,11 @@ def parse_args():
'./outputs/default.',
default=None,
type=str)
parser.add_argument('--custom-config-dir',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
parser.add_argument('--custom-config-dir',
parser.add_argument('--config-dir', default='configs',

In this way the parameter name can be shorter and more concise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -60,7 +60,8 @@ def get_config_from_arg(args) -> Config:
raise ValueError('You must specify "--datasets" if you do not specify '
'a config file path.')
datasets = []
for dataset in match_cfg_file('configs/datasets/', args.datasets):
config_base_dir = args.custom_config_dir or 'configs'
for dataset in match_cfg_file(f'{config_base_dir}/datasets/', args.datasets):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using os.path.join is better than string-style concatenation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

opencompass/utils/run.py Show resolved Hide resolved
Copy link
Collaborator

@gaotongxiao gaotongxiao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gaotongxiao gaotongxiao merged commit b2926ea into open-compass:main Sep 22, 2023
3 checks passed
go-with-me000 pushed a commit to go-with-me000/opencompass that referenced this pull request Oct 9, 2023
* support customize config path

* support customize config path

* support customize config path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants