PKU-Alignment / align-anything

Align Anything: Training All-modality Model with Feedback
https://align-anything.readthedocs.io
Apache License 2.0
260 stars 47 forks source link

feat: add yaml load feature #38

Closed cby-pku closed 3 months ago

cby-pku commented 3 months ago

Description

Support for using environment variables in the bash scripts to fill in the relevant values in the yaml file. The current pipeline of align-anything is you can reset your related hyper-parameters in the yaml file, and change defined environment variables in the bash script. However, we are lacking of a description of the defined environment variables list, and if we want to use bash script for multi-group experiments for the same module with different hyper-parameters, it will occur some challenge.

The added code supports that you can by control your hyper-parameters of yaml file in bash script.

Example

    export ENV_PREFIX__MODEL_CFGS__MODEL_ID=${MODEL_NAME}
    export ENV_PREFIX__MODEL_CFGS__MODEL_NAME_OR_PATH=${MODEL_NAME_PATH}

ENV_PREFIX__ is identifiable prefix. And the above command will change the model_configs: model_id and model_configs: model_name_or_path in your current module-related yaml file.

default:
  # Model configurations
  model_cfgs:
    model_id: null -> ${MODEL_NAME}
    # Pretrained model name or path
    model_name_or_path: null -> ${MODEL_NAME_PATH}
    # Whether to trust remote code
    trust_remote_code: True
    # The max token length
    model_max_length: 2048

Motivation and Context

Why is this change required? What problem does it solve? If it fixes an open issue, please link to the issue here. You can use the syntax close #1314520 if this solves the issue #15213

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

Checklist

Go over all the following points, and put an x in all the boxes that apply. If you are unsure about any of these, don't hesitate to ask. We are here to help!