abdeladim-s / easymms

A simple Python package to easily use Meta's Massively Multilingual Speech (MMS) project
https://abdeladim-s.github.io/easymms/
Other
52 stars 5 forks source link

Unable to run script #9

Open aponski opened 1 year ago

aponski commented 1 year ago

Hi, I'm trying to run simple script

from easymms.models.asr import ASRModel
import os 
directory = os.getcwd()
file_name = 'urzad-gminy-3min.wav'
file_path =  os.path.join(directory, file_name)
model_name = 'mms1b_all.pt'
model_path =  os.path.join(directory, 'model', model_name)

asr = ASRModel(model=model_path)
files = [file_path]

transcriptions = asr.transcribe(files, lang='pl', align=True)
for i, transcription in enumerate(transcriptions):
    print(f">>> file {files[i]}")
    for segment in transcription:
        print(f"{segment['start_time']} -> {segment['end_time']}: {segment['text']}")
    print("----")

and get an error

[2023-08-11 14:46:50,781] {asr.py:138} INFO - Preparing file C:\Users\apons\Desktop\Whisper\urzad-gminy-3min.wav
[2023-08-11 14:46:53,334] {utils.py:88} INFO - C:\Users\apons\AppData\Local\easymms\easymms\fairseq already exists
[2023-08-11 14:46:54,350] {asr.py:117} INFO - Setting up tmp dir: <TemporaryDirectory 'C:\\Users\\apons\\AppData\\Local\\Temp\\tmp01gr_toh'>
[2023-08-11 14:46:54,370] {infer.py:405} INFO - C:\Users\apons\Desktop\Whisper\model\mms1b_all.pt
Traceback (most recent call last):
  File "C:\Users\apons\Desktop\Whisper\meta-mms-2.py", line 14, in <module>
    transcriptions = asr.transcribe(files, lang='pl', align=True)
  File "C:\Users\apons\.conda\envs\metamms\lib\site-packages\easymms\models\asr.py", line 214, in transcribe
    self.wer = hydra_main(cfg)
  File "C:\Users\apons\.conda\envs\metamms\lib\site-packages\hydra\main.py", line 27, in decorated_main
    return task_function(cfg_passthrough)
  File "C:\Users\apons\AppData\Local\easymms\easymms\fairseq\examples\speech_recognition\new\infer.py", line 460, in hydra_main
    distributed_utils.call_main(cfg, main)
  File "C:\Users\apons\.conda\envs\metamms\lib\site-packages\fairseq\distributed\utils.py", line 369, in call_main
    main(cfg, **kwargs)
  File "C:\Users\apons\AppData\Local\easymms\easymms\fairseq\examples\speech_recognition\new\infer.py", line 407, in main
    with InferenceProcessor(cfg) as processor:
  File "C:\Users\apons\AppData\Local\easymms\easymms\fairseq\examples\speech_recognition\new\infer.py", line 104, in __init__
    models, saved_cfg = self.load_model_ensemble()
  File "C:\Users\apons\AppData\Local\easymms\easymms\fairseq\examples\speech_recognition\new\infer.py", line 229, in load_model_ensemble
    models, saved_cfg = checkpoint_utils.load_model_ensemble(
  File "C:\Users\apons\.conda\envs\metamms\lib\site-packages\fairseq\checkpoint_utils.py", line 367, in load_model_ensemble
    ensemble, args, _task = load_model_ensemble_and_task(
  File "C:\Users\apons\.conda\envs\metamms\lib\site-packages\fairseq\checkpoint_utils.py", line 425, in load_model_ensemble_and_task
    state = load_checkpoint_to_cpu(filename, arg_overrides)
  File "C:\Users\apons\.conda\envs\metamms\lib\site-packages\fairseq\checkpoint_utils.py", line 314, in load_checkpoint_to_cpu
    with open(local_path, "rb") as f:
PermissionError: [Errno 13] Permission denied: 'C:'
abdeladim-s commented 1 year ago

Hi @aponski,

It seems like you have some permission issues with your AppData folder or conda env, maybe Python does not have the right permissions to execute files in one of those directories. I would suggest to change the rwx permissions of those folders to something less strict to solve this issue.