tarepan / SpeechMOS

Easy-to-Use Speech MOS predictors
MIT License
196 stars 13 forks source link

Compatibility with older Python versions #3

Closed Takaaki-Saeki closed 9 months ago

Takaaki-Saeki commented 9 months ago

Hi, thank you for the great work!

I am now integrating this toolkit to ESPnet through this PR so that many ESPnet users can do pseudo MOS evaluations.

SpeechMOS depends on Python>=3.10, but I think it is desirable to be able to use older python versions if possible. My understanding is that one of the dependencies in python 3.10 comes from this part, because I get the following error when running SpeechMOS with Python 3.8.

from speechmos.utmos22.strong.model import UTMOS22Strong # pylint: disable=wrong-import-position
File ".cache/torch/hub/tarepan_SpeechMOS_v1.1.0/speechmos/utmos22/strong/model.py", line 7, in <module>
from ..fairseq_alt import Wav2Vec2Model
File ".cache/torch/hub/tarepan_SpeechMOS_v1.1.0/speechmos/utmos22/fairseq_alt.py", line 43, in <module>
class ConvFeatureExtractionModel(nn.Module):
File ".cache/torch/hub/tarepan_SpeechMOS_v1.1.0/speechmos/utmos22/fairseq_alt.py", line 46, in ConvFeatureExtractionModel
def __init__(self, conv_layers: list[tuple[int, int, int]]):
TypeError: 'type' object is not subscriptable

This can be avoid by using typing.List, instead of list as discussed here.

Therefore, could you please consider releasing it on torch.hub so that it can be used with older Python versions?

Thank you again for releasing the great toolkit.

tarepan commented 9 months ago

I am grad to hear that this repository will contribute to great ESPNet!

New feature "old Python support" sounds good.
If someone make a pull request, I gladly review it.

Do you have motivation to make the pull request?
Currently SpeechMOS do not implement CI workflow for public pull request.
If you have motivation to make the 'Py3.8 mode' PR, I will quickly prepare the CI workflow, then notify you to 'now we can make a pull request!'

Takaaki-Saeki commented 9 months ago

Thank you for the quick response! Then let me send a PR if it's ready :)

tarepan commented 9 months ago

We are ready, @Takaaki-Saeki πŸ‘

Below is a list of repository-wide (not model part) modification points for 'Py3.8 mode'.
Please include below mods.

Takaaki-Saeki commented 9 months ago

Thanks! I will send a PR with changes as you suggested. BTW, I have released a model on my forked repo. The following runs successfully with python 3.8.

predictor = torch.hub.load("Takaaki-Saeki/SpeechMOS:v1.1.0", "utmos22_strong")