File size: 496 Bytes
d95efe1
 
 
d9b077a
d95efe1
 
 
d9b077a
d95efe1
 
2c53e2f
 
d95efe1
 
d9b077a
d95efe1
d9b077a
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import yaml
from transformers import pipeline


def load_pipelines_from_config(config_path: str):
    with open(config_path, "r") as f:
        model_config = yaml.safe_load(f.read())

    models = {}
    for model, config in model_config.items():
        name = f"{model} - ({', '.join(config['artist_names'])})"
        models[name] = pipeline(
            task=config["task"],
            model=config["model_name"],
            revision=config["hf_commit_hash"],
        )

    return models