from typing import Dict import yaml def ignore_warnings(): import warnings # Ignore UserWarning from torch.meshgrid warnings.filterwarnings('ignore', category=UserWarning, module='torch.functional') # Refined regex pattern to capture variations in the warning message pattern = r"Some weights of the model checkpoint at roberta-base were not used when initializing RobertaModel: \['lm_head\..*'\].*" warnings.filterwarnings('ignore', message=pattern) def parse_yaml(config_yaml: str) -> Dict: r"""Parse yaml file. Args: config_yaml (str): config yaml path Returns: yaml_dict (Dict): parsed yaml file """ with open(config_yaml, "r") as fr: return yaml.load(fr, Loader=yaml.FullLoader)