street-lab-tech/street-whisper-app

URGENT Bug: Silence torchaudio warnings

carmen-chau opened this issue · 1 comments

Silence the torchaudio warnings appearing prior to the CLI initializing:

Sample display message:

/path_to_env/lib/python3.9/site-packages/pyannote/audio/core/io.py:43: UserWarning: torchaudio._backend.set_audio_backend has been deprecated. With dispatcher enabled, this function is no-op. You can remove the function call. torchaudio.set_audio_backend("soundfile")

Resolved.

Formalized solution

According to this post and this post can utilize the following lines to silence all UserWarnings (including this one)

import warnings warnings.filterwarnings('ignore')


Alternate solution

Similar to #8 , this warning was caused by a depreciated call in one of the dependency files.

On MacOS, the file could be found at the path /path_to_env/lib/python3.9/site-packages/pyannote/audio/core/io.py, where path_to_env specifies the absolute path to the env.

In io.py, comment out the line: torchaudio.set_audio_backend("soundfile"). This is found at line 43 (see reference here).

In other words, the header of io.py should now be:

/*.... omitted some lines near the beginning*/

import math
import random
import warnings
from io import IOBase
from pathlib import Path
from typing import Mapping, Optional, Text, Tuple, Union

import numpy as np
import torch.nn.functional as F
import torchaudio
from pyannote.core import Segment
from torch import Tensor

#torchaudio.set_audio_backend("soundfile")