huggingface / speech-to-speech

Speech To Speech: an effort for an open-sourced and modular GPT4-o
Apache License 2.0
3.49k stars 362 forks source link

Error with running Mac device #26

Closed BIGdeadLock closed 2 months ago

BIGdeadLock commented 2 months ago

I'm trying to run the command:

python s2s_pipeline.py --recv_host localhost --send_host localhost --device mps

As mention in the guide to run it on mac use the --device mps flag.

When doing so I'm getting the following error:

    raise ValueError(f"Some specified arguments are not used by the HfArgumentParser: {remaining_args}")
ValueError: Some specified arguments are not used by the HfArgumentParser: ['--device', 'mps']
RonanKMcGovern commented 2 months ago

Swap branch

On Wed 21 Aug 2024 at 08:47, BIGdeadLock @.***> wrote:

I'm trying to run the command:

python s2s_pipeline.py --recv_host localhost --send_host localhost --device mps

As mention in the guide to run it on mac use the --device mps flag.

When doing so I'm getting the following error:

raise ValueError(f"Some specified arguments are not used by the HfArgumentParser: {remaining_args}")

ValueError: Some specified arguments are not used by the HfArgumentParser: ['--device', 'mps']

— Reply to this email directly, view it on GitHub https://github.com/huggingface/speech-to-speech/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASVG6CVO7GLSGJXWGBSMEBLZSRAYHAVCNFSM6AAAAABM3NVIY2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3TOMZSGE2TMMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

BIGdeadLock commented 2 months ago

@RonanKMcGovern

Oh, did not see the mps support branch. Will try!

BIGdeadLock commented 2 months ago

@RonanKMcGovern

Getting a different error now:

    from MeloTTS.melo.api import TTS
ModuleNotFoundError: No module named 'MeloTTS'

pip install does not work. Have any suggestions?

BIGdeadLock commented 2 months ago

Update:

  1. I Tried
    git clone https://github.com/myshell-ai/MeloTTS.git

To the TTS folder. After running the same command again I still got an error with the relative paths in MeloTTS.

  1. To fix it I went into MeloTTS and changed:

    from MeloTTS.melo.api import TTS -> from .MeloTTS.melo.api import TTS
  2. At the melo package I changed all imports to be .. relative.

After that I tried pip install -r requirements.txt in the MeloTTS repo. I got a error on the cached_path package so I commented it out. Then the installation went OK.

  1. Now I'm getting a different error when running the server that is connected to the MeloTTS:
    from TTS.melotts import MeloTTSHandler
  File "/Users/eden.yavin/Projects/speech-to-speech/TTS/melotts.py", line 1, in <module>
    from .MeloTTS.melo.api import TTS
  File "/Users/eden.yavin/Projects/speech-to-speech/TTS/MeloTTS/melo/api.py", line 13, in <module>
    from . import utils
  File "/Users/eden.yavin/Projects/speech-to-speech/TTS/MeloTTS/melo/utils.py", line 13, in <module>
    from ..melo.text.cleaner import clean_text
  File "/Users/eden.yavin/Projects/speech-to-speech/TTS/MeloTTS/melo/text/cleaner.py", line 1, in <module>
    from . import chinese, japanese, english, chinese_mix, korean, french, spanish
  File "/Users/eden.yavin/Projects/speech-to-speech/TTS/MeloTTS/melo/text/japanese.py", line 367, in <module>
    _TAGGER = MeCab.Tagger()
  File "/Users/eden.yavin/Projects/speech-to-speech/venv/lib/python3.9/site-packages/MeCab/__init__.py", line 139, in __init__
    raise RuntimeError(error_info(rawargs)) from ee
RuntimeError: 
----------------------------------------------------------

Failed initializing MeCab. Please see the README for possible solutions:

    https://github.com/SamuraiT/mecab-python3#common-issues

If you are still having trouble, please file an issue here, and include the
ERROR DETAILS below:

    https://github.com/SamuraiT/mecab-python3/issues

issueを英語で書く必要はありません。

------------------- ERROR DETAILS ------------------------
arguments: 
default dictionary path: /Users/eden.yavin/Projects/speech-to-speech/venv/lib/python3.9/site-packages/unidic/dicdir
[ifs] no such file or directory: /Users/eden.yavin/Projects/speech-to-speech/venv/lib/python3.9/site-packages/unidic/dicdir/mecabrc
----------------------------------------------------------
BIGdeadLock commented 2 months ago

Update:

  1. Looking at the mec-python Project, seems like the following command was missing:
python -m unidic download
andimarafioti commented 2 months ago

Did you manage to get it to work?

andimarafioti commented 2 months ago

I need to work on the setup, sorry, I should get there soon

BIGdeadLock commented 2 months ago

@andimarafioti

I'm having trouble with the

python -m unidic download

For some reason the download gets stuck at 140/520 MB.

andimarafioti commented 2 months ago

Some people are having other problems, you can follow them here: https://github.com/huggingface/speech-to-speech/pull/20 I'm trying to debug it

BIGdeadLock commented 2 months ago

@andimarafioti

managed to finish the download after restarting the program

BIGdeadLock commented 2 months ago

@andimarafioti

Next error on the schedule:

ImportError: cannot import name 'TextIteratorStreamer' from 'transformers' (/Users/eden.yavin/Projects/speech-to-speech/venv/lib/python3.9/site-packages/transformers/__init__.py)
andimarafioti commented 2 months ago

melotts downgrades the transformer version, just do pip install -r requirements.txt

andimarafioti commented 2 months ago

When you run the code, the default will be parler. I just fixed a bug with it, so you can do git pull to run with it. Otherwise, you can choose to test with melo as tts, for it pass --tts melo to the python call. The video I uploaded was using melotts

BIGdeadLock commented 2 months ago

I install the requirements again and did git pull. Also updated transformers to 4.43.0

BIGdeadLock commented 2 months ago

Screenshot 2024-08-21 at 17 11 10

BIGdeadLock commented 2 months ago

@andimarafioti Screenshot 2024-08-21 at 17 22 46

I ran the python s2s_pipeline.py --mode local --device mps --lm_model_name HuggingFaceTB/SmolLM-360M-Instruct command and it works!

BIGdeadLock commented 2 months ago

Running the command:

python listen_and_play.py --host localhost --device mps --lm_model_name HuggingFaceTB/SmolLM-360M-Instruct

(Which I don't know its purpuse)

raised the error:

  File "/Users/eden.yavin/Projects/speech-to-speech/listen_and_play.py", line 126, in <module>
    listen_and_play(**vars(listen_and_play_kwargs))
  File "/Users/eden.yavin/Projects/speech-to-speech/listen_and_play.py", line 42, in listen_and_play
    send_socket.connect((host, send_port))
ConnectionRefusedError: [Errno 61] Connection refused
BIGdeadLock commented 2 months ago

@andimarafioti

Also for some reason the llm used is phi although I passed --lm_model_name HuggingFaceTB/SmolLM-360M-Instruct.

Screenshot 2024-08-21 at 17 32 48

BIGdeadLock commented 2 months ago

Screenshot 2024-08-21 at 17 38 51

Having trouble with the melo though if pass the flag --tts melo

BIGdeadLock commented 2 months ago

Ok it is still all about the relative paths. Had to change

from melo.text.ko_dictionary import english_dictionary, etc_dictionary -> from ...melo.text.ko_dictionary import english_dictionary, etc_dictionary

Working on doing the same to other imports

BIGdeadLock commented 2 months ago

Seems that doing that and pip install cached-path did the trick. The response time and voice is a lot better!

Screenshot 2024-08-21 at 17 45 09

ChristianWeyer commented 2 months ago

(I love that live ticker... @BIGdeadLock 😁)

andimarafioti commented 2 months ago

You don't need the listen_and_play command when running ni local mode :)

andimarafioti commented 2 months ago

I think the issue with the relative paths is because you cloned the repo inside of this one and/or didn't install melo.

BIGdeadLock commented 2 months ago

@andimarafioti Installing it did not work unfortunately.

What about the lm flag?

ArvinZhuang commented 2 months ago

I made it work with tts parler by moving from TTS.melotts import MeloTTSHandler to under elif module_kwargs.tts == 'melo': so that can avoid install MeloTTS...

BIGdeadLock commented 2 months ago

@ArvinZhuang

But what if you want to use MeloTTS? I cloned it to the TTS dir and it worked

andimarafioti commented 2 months ago

@BIGdeadLock for the lm flag, the smol model doesn't work with MLX-LM so as a quick fix I overwrote it. I now pushed a change to let you choose the Language Model implementation. By default it uses transformers which will work with the SMOL LM. Let me know how it goes!

andimarafioti commented 2 months ago

@ArvinZhuang I love that idea. Pushed it to the PR, thanks!

ChristianWeyer commented 2 months ago

So... are we now at a point where macOS should work flawlessly? @andimarafioti

andimarafioti commented 2 months ago

Yes! I merged the PR to main. Now the uv pip install -r requirements.txt should work for melo as well. There is after the python -m unidic download that you still need to do if you want to run with melo, but I decided to leave that as a warning if it fails since it adds 550mb to the install, and there wasn't a clean way to do it. I also added a flag to run locally with mac (sets devices and models to what I think works best 😅) And I adapted the readme :)

ChristianWeyer commented 2 months ago

Thanks, will try it now :-)