BrasD99 / HeyGenClone

A simple and open-source analogue of the HeyGen system
862 stars 172 forks source link

AttributeError: 'SpeakerDiarization' object has no attribute 'to'` #6

Closed fengyunzaidushi closed 9 months ago

fengyunzaidushi commented 9 months ago

i find the same issue feat: send pipeline to device with Pipeline.to(device)

Using device: cuda
model_name is pyannote/speaker-diarization@2.1
Traceback (most recent call last):
  File "/mnt/sda/github/11yue/HeyGenClone/translate_fxy.py", line 47, in <module>
    translate(
  File "/mnt/sda/github/11yue/HeyGenClone/translate_fxy.py", line 33, in translate
    engine = Engine(config, output_language)
  File "/mnt/sda/github/11yue/HeyGenClone/core/engine.py", line 38, in __init__
    self.diarize_model = DiarizationPipeline(use_auth_token=config['HF_TOKEN'], device=self.device)
  File "/mnt/sda/github/11yue/HeyGenClone/core/whisperx/diarize.py", line 21, in __init__
    self.model = self.model.to(device)
  File "/opt/miniconda3/envs/heygenclone/lib/python3.10/site-packages/pyannote/pipeline/pipeline.py", line 100, in __getattr__
    raise AttributeError(msg)
AttributeError: 'SpeakerDiarization' object has no attribute 'to'
fengyunzaidushi commented 9 months ago
class DiarizationPipeline:
    def __init__(
        self,
        model_name='pyannote/speaker-diarization@2.1',
        use_auth_token=None,
        device: Optional[Union[str, torch.device]] = 'cpu',
    ):
        if isinstance(device, str):
            device = torch.device(device)

        print(f'model_name is {model_name}')
        self.model = Pipeline.from_pretrained(model_name, use_auth_token=use_auth_token).to(device)

i think the issue is which version of pyannote.audio should be installed

BrasD99 commented 9 months ago

Have you visited speaker-diarization, segmentation and accepted user conditions?

fengyunzaidushi commented 9 months ago

Have you visited speaker-diarization, segmentation and accepted user conditions?您是否访问过扬声器分类、细分和接受的用户条件?

yes,i have accepted yet.

BrasD99 commented 9 months ago

I'll check this out. Thank you for this issue.

BrasD99 commented 9 months ago

@fengyunzaidushi could you please send the versions of the installed packages?

pip list

I have already met this error. In my case, it occurred in two cases:

  1. I set the wrong HF_TOKEN;
  2. I did not accept the user conditions.
BrasD99 commented 9 months ago

@fengyunzaidushi check out new install.sh script.