oobabooga / text-generation-webui

A Gradio web UI for Large Language Models.
GNU Affero General Public License v3.0
39.6k stars 5.21k forks source link

Issue with Elevenlabs TTS on one-click install #1648

Closed Siigari closed 1 year ago

Siigari commented 1 year ago

Describe the bug

Hello, I am getting this error:

Loading the extension "gallery"... Ok. Loading the extension "send_pictures"... Ok. Loading the extension "sd_api_pictures"... Ok. Open error: is JACK server running? Loading the extension "elevenlabs_tts"... Fail. Traceback (most recent call last): File "F:\oobabooga_windows\text-generation-webui\modules\extensions.py", line 33, in load_extensions exec(f"import extensions.{name}.script") File "", line 1, in File "F:\oobabooga_windows\text-generation-webui\extensions\elevenlabs_tts\script.py", line 6, in from elevenlabslib.helpers import save_bytes_to_path ImportError: cannot import name 'save_bytes_to_path' from 'elevenlabslib.helpers' (F:\oobabooga_windows\installer_files\env\lib\site-packages\elevenlabslib\helpers.py)

I do not know what to do about this. I use an ASIO driver for audio, and it is running (so the Jack server is installed and online.

Is there an existing issue for this?

Reproduction

Start web-ui.

Screenshot

No response

Logs

Loading the extension "gallery"... Ok.
Loading the extension "send_pictures"... Ok.
Loading the extension "sd_api_pictures"... Ok.
Open error: is JACK server running?
Loading the extension "elevenlabs_tts"... Fail.
Traceback (most recent call last):
  File "F:\oobabooga_windows\text-generation-webui\modules\extensions.py", line 33, in load_extensions
    exec(f"import extensions.{name}.script")
  File "<string>", line 1, in <module>
  File "F:\oobabooga_windows\text-generation-webui\extensions\elevenlabs_tts\script.py", line 6, in <module>
    from elevenlabslib.helpers import save_bytes_to_path
ImportError: cannot import name 'save_bytes_to_path' from 'elevenlabslib.helpers' (F:\oobabooga_windows\installer_files\env\lib\site-packages\elevenlabslib\helpers.py)

System Info

13900KS
2x 4090
64GB DDR5 6000
gopfranco commented 1 year ago

me too. same sort of error. I used to be able to get elevenlabs going with flags but i have tried them in the command line and they arent working. maybe someone could let us know how to fix this with flag if its not possible to fix it in code right away. Or maybe there is something we are missing? thank you everyone for your hard work.

To create a public link, set share=True in launch(). Closing server running on port: 7860 Loading the extension "gallery"... Ok. Loading the extension "elevenlabs_tts"... Fail. Traceback (most recent call last): File "C:\Users\win11alpha\Downloads\oobabooga_windows\oobabooga_windows\text-generation-webui\modules\extensions.py", line 33, in load_extensions exec(f"import extensions.{name}.script") File "", line 1, in File "C:\Users\win11alpha\Downloads\oobabooga_windows\oobabooga_windows\text-generation-webui\extensions\elevenlabs_tts\script.py", line 6, in from elevenlabslib.helpers import save_bytes_to_path ImportError: cannot import name 'save_bytes_to_path' from 'elevenlabslib.helpers' (C:\Users\win11alpha\Downloads\oobabooga_windows\oobabooga_windows\installer_files\env\lib\site-packages\elevenlabslib\helpers.py)

shaneholloman commented 1 year ago

same issue here with fresh install

I may add that during startup, I got this error, which I haven't solved yet. Looks like some correlation?

Gradio HTTP request redirected to localhost :)
bin D:\ai\apps\oobabooga_windows\installer_files\env\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.dll
D:\ai\apps\oobabooga_windows\installer_files\env\lib\site-packages\bitsandbytes\cextension.py:33: UserWarning: The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers, 8-bit multiplication, and GPU quantization are unavailable.
  warn("The installed version of bitsandbytes was compiled without GPU support. "
ezra-ch commented 1 year ago

same issue


Loading the extension "elevenlabs_tts"... Fail.
Traceback (most recent call last):
  File "G:\LLM_ui\oobabooga_windows\text-generation-webui\modules\extensions.py", line 33, in load_extensions
    exec(f"import extensions.{name}.script")
  File "<string>", line 1, in <module>
  File "G:\LLM_ui\oobabooga_windows\text-generation-webui\extensions\elevenlabs_tts\script.py", line 6, in <module>
    from elevenlabslib.helpers import save_bytes_to_path
ImportError: cannot import name 'save_bytes_to_path' from 'elevenlabslib.helpers' (G:\LLM_ui\oobabooga_windows\installer_files\env\lib\site-packages\elevenlabslib\helpers.py)```
ezra-ch commented 1 year ago

i solved it by editing the elevenlabs scrip.py from from elevenlabslib.helpers import save_byte_to_path to elevenlabslib.helpers import *

ezra-ch commented 1 year ago

actually it just fix the extension failing to load problem. and i got new errors


  File "G:\LLM_ui\oobabooga_windows\installer_files\env\lib\site-packages\gradio\routes.py", line 395, in run_predict
    output = await app.get_blocks().process_api(
  File "G:\LLM_ui\oobabooga_windows\installer_files\env\lib\site-packages\gradio\blocks.py", line 1193, in process_api
    result = await self.call_function(
  File "G:\LLM_ui\oobabooga_windows\installer_files\env\lib\site-packages\gradio\blocks.py", line 930, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "G:\LLM_ui\oobabooga_windows\installer_files\env\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "G:\LLM_ui\oobabooga_windows\installer_files\env\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "G:\LLM_ui\oobabooga_windows\installer_files\env\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "G:\LLM_ui\oobabooga_windows\installer_files\env\lib\site-packages\gradio\utils.py", line 491, in async_iteration
    return next(iterator)
  File "G:\LLM_ui\oobabooga_windows\text-generation-webui\modules\chat.py", line 247, in cai_chatbot_wrapper
    for history in chatbot_wrapper(text, state):
  File "G:\LLM_ui\oobabooga_windows\text-generation-webui\modules\chat.py", line 187, in chatbot_wrapper
    visible_reply = apply_extensions("output", visible_reply)
  File "G:\LLM_ui\oobabooga_windows\text-generation-webui\modules\extensions.py", line 115, in apply_extensions
    return EXTENSION_MAP[typ](*args, **kwargs)
  File "G:\LLM_ui\oobabooga_windows\text-generation-webui\modules\extensions.py", line 61, in _apply_string_extensions
    text = getattr(extension, function_name)(text)
  File "G:\LLM_ui\oobabooga_windows\text-generation-webui\extensions\elevenlabs_tts\script.py", line 99, in output_modifier
    save_bytes_to_path(Path(f'extensions/elevenlabs_tts/outputs/{wav_idx:06d}.wav'), audio_data)
NameError: name 'save_bytes_to_path' is not defined
ezra-ch commented 1 year ago

this error is due to the function being removed from the library: https://github.com/lugia19/elevenlabslib/commit/b4d3993939efc00c5261986443fc7a077431fd90 even with using the new function save_audio_bytes i get this flush error AttributeError: 'WindowsPath' object has no attribute 'flush' but the voice file gets saved properly, so right now im just trying to delete some code from the library, However, i imagine it works if you just download an older version of elevenlabslib

subversion23 commented 1 year ago

found a solution that works at least for me.

1744

DGdev91 commented 1 year ago

Seems like Elevenlabs now offers an official API. It's also possible to use it for free without any api key, but with a limited character number https://pypi.org/project/elevenlabs/ https://github.com/elevenlabs/elevenlabs-python

Could be a possible alternative if the existing extension still have problems

TechnoTaff commented 1 year ago

I have submitted a fix for this extension:

https://github.com/oobabooga/text-generation-webui/pull/1775

TechnoTaff commented 1 year ago

found a solution that works at least for me. #1744

Sorry @subversion23, I didn't see your PR but we came to similar conclusions. I have also added a bunch of options "borrowed" from silero_tts.

Siigari commented 1 year ago

found a solution that works at least for me. #1744

I attempted that and got the following error:

checking api Got an API Key! Output generated in 6.03 seconds (0.50 tokens/s, 3 tokens, context 303, seed 867057625) Traceback (most recent call last): File "F:\oobabooga_windows\installer_files\env\lib\site-packages\gradio\routes.py", line 395, in run_predict output = await app.get_blocks().process_api( File "F:\oobabooga_windows\installer_files\env\lib\site-packages\gradio\blocks.py", line 1193, in process_api result = await self.call_function( File "F:\oobabooga_windows\installer_files\env\lib\site-packages\gradio\blocks.py", line 930, in call_function prediction = await anyio.to_thread.run_sync( File "F:\oobabooga_windows\installer_files\env\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "F:\oobabooga_windows\installer_files\env\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "F:\oobabooga_windows\installer_files\env\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run result = context.run(func, *args) File "F:\oobabooga_windows\installer_files\env\lib\site-packages\gradio\utils.py", line 491, in async_iteration return next(iterator) File "F:\oobabooga_windows\text-generation-webui\modules\chat.py", line 247, in cai_chatbot_wrapper for history in chatbot_wrapper(text, state): File "F:\oobabooga_windows\text-generation-webui\modules\chat.py", line 187, in chatbot_wrapper visible_reply = apply_extensions("output", visible_reply) File "F:\oobabooga_windows\text-generation-webui\modules\extensions.py", line 115, in apply_extensions return EXTENSION_MAP[typ](*args, **kwargs) File "F:\oobabooga_windows\text-generation-webui\modules\extensions.py", line 61, in _apply_string_extensions text = getattr(extension, function_name)(text) File "F:\oobabooga_windows\text-generation-webui\extensions\elevenlabs_tts\script.py", line 99, in output_modifier save_audio_bytes(Path(f'extensions/elevenlabs_tts/outputs/{wav_idx:06d}.wav'), audio_data) TypeError: save_audio_bytes() missing 1 required positional argument: 'outputFormat'

subversion23 commented 1 year ago

found a solution that works at least for me. #1744

Sorry @subversion23, I didn't see your PR but we came to similar conclusions. I have also added a bunch of options "borrowed" from silero_tts.

thats ok. My PR was just a quick fix to get it working. Yours is clearly a better solution, i close mine.

TechnoTaff commented 1 year ago

@subversion23 / @DGdev91 I have closed my original PR. I have now re-implemented using the official EL API!

https://github.com/oobabooga/text-generation-webui/pull/1787

It works really well! API key now optional for limited testing.

subversion23 commented 1 year ago

@Siigari From the error message it seems like the fileformat 'wav' param is missing. should be: save_audio_bytes(audio_data, str(output_file), 'wav')

but since @TechnoTaff already has a better solution, i would go with his.

TechnoTaff commented 1 year ago

Screenshot: image

gopfranco commented 1 year ago

Kind of a newby. Can someone please explain to me how to implement the fix? Has the PR been merged with the main repository yet?

On Thu, 4 May 2023, 9:28 pm Steve Randall, @.***> wrote:

Screenshot: [image: image] https://user-images.githubusercontent.com/14032712/236196638-e6295b3b-2ec5-4ba3-bc7a-d62967617cc2.png

— Reply to this email directly, view it on GitHub https://github.com/oobabooga/text-generation-webui/issues/1648#issuecomment-1534643736, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5ADMF7TJKYCTK5TI2YKSNLXEOKXPANCNFSM6AAAAAAXQEM7CM . You are receiving this because you commented.Message ID: @.***>

TechnoTaff commented 1 year ago

It's not merged yet, you can try it on your local machine as follows:

git fetch origin pull/1787/head:pr/1787 && git checkout pr/1787

If it works for you, could you please add a code review on the PR, thank you!

gopfranco commented 1 year ago

Thank you!

On Fri, 5 May 2023, 9:16 am Steve Randall, @.***> wrote:

It's not merged yet, you can try it on your local machine as follows:

git fetch origin pull/1787/head:pr/1787 && git checkout pr/1787

— Reply to this email directly, view it on GitHub https://github.com/oobabooga/text-generation-webui/issues/1648#issuecomment-1535534351, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5ADMF5UEFBTR5WM54NHBSDXEQ5XFANCNFSM6AAAAAAXQEM7CM . You are receiving this because you commented.Message ID: @.***>

Copterz commented 1 year ago

It's not merged yet, you can try it on your local machine as follows:

git fetch origin pull/1787/head:pr/1787 && git checkout pr/1787

If it works for you, could you please add a code review on the PR, thank you!

Just pulled and tested it out. Never had TTS setup before, so just installed the requirements.txt in the elevenlabs_tts dir and loaded up ooba. Entered my api key and way to go, it works perfectly. Thanks for this!

aiaiai123 commented 1 year ago

It's not merged yet, you can try it on your local machine as follows:

git fetch origin pull/1787/head:pr/1787 && git checkout pr/1787

If it works for you, could you please add a code review on the PR, thank you!

still learning all of this, i ran the command but get a new error now: \oobabooga\text-generation-webui\extensions\elevenlabs_tts\script.py", line 5, in import elevenlabs ModuleNotFoundError: No module named 'elevenlabs'

Would you mind pointing me in the right direction? I did notice in the sitepackages folder this is no longer an elevenlabs folder after running the command

gopfranco commented 1 year ago

I could be wrong but from what I understand you go to eleven labs Web site and start an account. Go to your profile and copy the api from there. Then put it in oobabooga box where it asks for api.

On Fri, 5 May 2023, 3:09 pm alps404, @.***> wrote:

Okay got this running but, time to ask a stupid question sorry I'm new to all this. What exactly do I put in the "API Key" field. I've tried the same API address I use to connect to TavernAI but it just says "Error".

— Reply to this email directly, view it on GitHub https://github.com/oobabooga/text-generation-webui/issues/1648#issuecomment-1535721244, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5ADMF27C3YBSDQ2NS3G3K3XESHAJANCNFSM6AAAAAAXQEM7CM . You are receiving this because you commented.Message ID: @.***>

TechnoTaff commented 1 year ago

@Siigari This is now resolved. https://github.com/oobabooga/text-generation-webui/pull/1830 merged.

github-actions[bot] commented 1 year ago

This issue has been closed due to inactivity for 6 weeks. If you believe it is still relevant, please leave a comment below. You can tag a developer in your comment.