huggingface / dataspeech

MIT License
313 stars 48 forks source link

Error in computing snr: AttributeError: 'CustomPyanNetModel' object has no attribute 'example_output' #22

Open light1726 opened 6 months ago

light1726 commented 6 months ago

Hi! Thanks for the great work!

I run the following command to extract features:

CUDA_VISIBLE_DEVICES=0,1,2,3 python main.py --dataset_name /path/to/my/local/dataset --output_dir /path/to/my/feats/ --cpu_num_workers 32 --num_workers_per_gpu_for_pitch 8 --num_workers_per_gpu_for_snr 8

It seems that it successfully extracted the pitch, but encountered the following error when computing snr:

Model was trained with pyannote.audio 0.0.1, yours is 3.2.0. Bad things might happen unless you revert pyannote.audio to 0.x.
Model was trained with torch 1.12.1+cu102, yours is 2.3.0+cu121. Bad things might happen unless you revert torch to 1.x.
Map (num_proc=32):   0%|                                                                                                                                                              | 0/8000 [00:25<?, ? examples/s]
multiprocess.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/multiprocess/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/datasets/utils/py_utils.py", line 678, in _write_generator_to_queue
    for i, result in enumerate(func(**kwargs)):
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/datasets/arrow_dataset.py", line 3547, in _map_single
    batch = apply_function_on_filtered_inputs(
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/datasets/arrow_dataset.py", line 3416, in apply_function_on_filtered_inputs
    processed_inputs = function(*fn_args, *additional_args, **fn_kwargs)
  File "/root/hui/dataspeech/dataspeech/gpu_enrichments/snr_and_reverb.py", line 22, in snr_apply
    pipeline = RegressiveActivityDetectionPipeline(segmentation=model)
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/brouhaha/pipeline.py", line 72, in __init__
    self._frames = self._segmentation.model.example_output.frames
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1709, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'CustomPyanNetModel' object has no attribute 'example_output'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "feature_extraction.py", line 66, in <module>
    snr_dataset = dataset.map(
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/datasets/dataset_dict.py", line 869, in map
    {
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/datasets/dataset_dict.py", line 870, in <dictcomp>
    k: dataset.map(
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/datasets/arrow_dataset.py", line 602, in wrapper
    out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/datasets/arrow_dataset.py", line 567, in wrapper
    out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/datasets/arrow_dataset.py", line 3248, in map
    for rank, done, content in iflatmap_unordered(
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/datasets/utils/py_utils.py", line 718, in iflatmap_unordered
    [async_result.get(timeout=0.05) for async_result in async_results]
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/datasets/utils/py_utils.py", line 718, in <listcomp>
    [async_result.get(timeout=0.05) for async_result in async_results]
  File "/root/miniconda3/envs/ds-env/lib/python3.8/site-packages/multiprocess/pool.py", line 771, in get
    raise self._value
AttributeError: 'CustomPyanNetModel' object has no attribute 'example_output'

Could you possibly help me understand what the CustomPyanNetModel is used for and the possible reason for this issue? Thanks in advance!

light1726 commented 6 months ago

I managed to resolve the issue by downgrading pyannote.audio to version 3.11. Check the reference here: https://huggingface.co/ylacombe/brouhaha-best/discussions/2

anioji commented 6 months ago

@ylacombe Could you pin the library versions to the project. Because over time your stack begins to fall apart. Libraries receive updates, but your project does not

WARNING - torchvision is not available - cannot save figures
INFO - Lightning automatically upgraded your loaded checkpoint from v1.6.5 to v2.2.2. To apply the upgrade to your files permanently, run `python -m pytorch_lightning.utilities.upgrade_checkpoint ../.cache/huggingface/hub/models--ylacombe--brouhaha-best/snapshots/99bf97b13fd4dda2434a6f7c50855933076f2937/best.ckpt`
Model was trained with pyannote.audio 0.0.1, yours is 3.1.1. Bad things might happen unless you revert pyannote.audio to 0.x.
Model was trained with torch 1.12.1+cu102, yours is 2.2.2+cu121. Bad things might happen unless you revert torch to 1.x.
ylacombe commented 6 months ago

Hey @anioji, the warning you got are specifically related to the Brouhaha library, and already appeared before, they shouldn't impact the library use.