cvqluu / simple_diarizer

Simplified diarization pipeline using some pretrained models - audio file to diarized segments in a few lines of code
GNU General Public License v3.0
141 stars 27 forks source link

AttributeError when running Diarizer in simple_diarizer.diarizer #4

Closed masonhargrave closed 2 years ago

masonhargrave commented 2 years ago

Hi there!

When running the following code in Python 3.7 on a fresh conda environment in Ubuntu 22.04

from simple_diarizer.diarizer import Diarizer

diar = Diarizer(
                    embed_model='xvec', # 'xvec' and 'ecapa' suported
                    cluster_method='sc' # 'ahc' and 'sc' supported
                )

I get the following error:


<ipython-input-3-286690ce0195> in <module>
      1 diar = Diarizer(
      2                     embed_model='xvec', # 'xvec' and 'ecapa' suported
----> 3                     cluster_method='sc' # 'ahc' and 'sc' supported
      4                 )

~/anaconda3/envs/test/lib/python3.7/site-packages/simple_diarizer/diarizer.py in __init__(self, embed_model, cluster_method, window, period)
     44             self.embed_model = EncoderClassifier.from_hparams(source="speechbrain/spkrec-xvect-voxceleb",
     45                                                               savedir="pretrained_models/spkrec-xvect-voxceleb",
---> 46                                                               run_opts=self.run_opts)
     47         if embed_model == 'ecapa':
     48             self.embed_model = EncoderClassifier.from_hparams(source="speechbrain/spkrec-ecapa-voxceleb",

~/anaconda3/envs/test/lib/python3.7/site-packages/speechbrain/pretrained/interfaces.py in from_hparams(cls, source, hparams_file, pymodule_file, overrides, savedir, use_auth_token, **kwargs)
    349         # Load the modules:
    350         with open(hparams_local_path) as fin:
--> 351             hparams = load_hyperpyyaml(fin, overrides)
    352 
    353         # Pretraining:

~/anaconda3/envs/test/lib/python3.7/site-packages/hyperpyyaml/core.py in load_hyperpyyaml(yaml_stream, overrides, overrides_must_match)
    187 
    188     # Remove items that start with "__"
--> 189     removal_keys = [k for k in hparams.keys() if k.startswith("__")]
    190     for key in removal_keys:
    191         del hparams[key]

AttributeError: 'str' object has no attribute 'keys'
cvqluu commented 2 years ago

I've updated dependencies recently to allow for newer versions of speechbrain. Can you try again, making to use the most recent version on pypi?

cvqluu commented 2 years ago

Closed due to no response, but repo should be functional.