jadechoghari commited on
Commit
0780f67
1 Parent(s): 9f22024

Update infer/infer_mos5.py

Browse files
Files changed (1) hide show
  1. infer/infer_mos5.py +8 -1
infer/infer_mos5.py CHANGED
@@ -15,7 +15,14 @@ from .audioldm_train.utilities.tools import build_dataset_json_from_list
15
  from torch.utils.data import DataLoader
16
  from pytorch_lightning import seed_everything
17
  from .audioldm_train.utilities.tools import get_restore_step
18
- from .audioldm_train.utilities.model_util import instantiate_from_config
 
 
 
 
 
 
 
19
 
20
 
21
  def infer(dataset_key, configs, config_yaml_path, exp_group_name, exp_name):
 
15
  from torch.utils.data import DataLoader
16
  from pytorch_lightning import seed_everything
17
  from .audioldm_train.utilities.tools import get_restore_step
18
+ def instantiate_from_config(config):
19
+ if not "target" in config:
20
+ if config == "__is_first_stage__":
21
+ return None
22
+ elif config == "__is_unconditional__":
23
+ return None
24
+ raise KeyError("Expected key `target` to instantiate.")
25
+ return get_obj_from_str(config["target"])(**config.get("params", dict()))
26
 
27
 
28
  def infer(dataset_key, configs, config_yaml_path, exp_group_name, exp_name):