Spaces:
Running
Running
Download utils.py from teamup-tech/AudioSep: direct link, hf CLI and curl.
- Browser
- Download file 759 Bytes
-
https://huggingface.co/spaces/teamup-tech/AudioSep/resolve/main/utils.py
- Command line
-
hf download hf://spaces/teamup-tech/AudioSep/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/teamup-tech/AudioSep/resolve/main/utils.py
759 Bytes
| 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) |