Spaces:
Running
Running
| import yaml | |
| # Load in model configuration and check the required keys are present | |
| model_config_dir = "config/model_config.yml" | |
| config_keys = ["system_message", "model_id", "template"] | |
| def load_config_values( | |
| model_config_dir=model_config_dir, | |
| config_keys=config_keys | |
| ): | |
| """ | |
| Function to extract user-input keys from config.yml | |
| Returns values as a list with length = length(config_keys) | |
| """ | |
| with open(model_config_dir, "r") as file: | |
| model_config = yaml.safe_load(file) | |
| values_list = [] | |
| for var in config_keys: | |
| if var not in model_config.keys(): | |
| raise ValueError(f"`{var}` key missing from `{model_config_dir}`") | |
| values_list.append(model_config[var]) | |
| return values_list | |