street-lab-tech / street-whisper-app

STREET Lab Whisper App - a tool that transcribes and translates audio files into CSV files.
MIT License
2 stars 0 forks source link

Bug: Silence warning from torchvision #8

Closed carmen-chau closed 4 months ago

carmen-chau commented 4 months ago

When a user is prompted to enter their authentication token, the following warning pops up. Figure out how to silence it:

torchvision is not available - cannot save figures

carmen-chau commented 4 months ago

RESOLVED. Fix is described below.

The issue is caused by one of the attempted imports by speechbrain.utils.train_logger (see this link for more details).

This file is found inside the env created to run this project. Specifically, for MacOS, it should be located in the following directory:

/path_to_env/lib/python3.9/site-packages/speechbrain/utils/train_logger.py

where path_to_env denotes the aboslute path of the virtual environment.

In train_logger.py, replace method get_image_saver() with the following code snippet will resolve the issue:

def _get_image_saver():
    """Returns the TorchVision image saver, if available
    or None if it is not - optional dependency"""
    try:
        import torchvision

        return torchvision.utils.save_image
    except ImportError:
        #logger.warning("torchvision is not available - cannot save figures")
        return None