Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG🐛] Error when using OpenAI server with speech generation #62

Open
elvinzade opened this issue Jan 14, 2025 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@elvinzade
Copy link

Bug Description

I encountered an error when attempting to use the OpenAI server for speech generation. Below is the error message and the code that caused it. This error occurs when i run script with enhance_speech": False otherwise it works but it provide low quality rather than actual coqui fine tuned model

Minimal Reproducible Example

from openai import OpenAI  
import base64  

text = "Hello"

reference_audio_path = "audio.wav"

client = OpenAI(  
        api_key="your-api-key",  base_url="url")  
with open(reference_audio_path, "rb") as f:  
    audio_data = base64.b64encode(f.read()).decode('utf-8')  # Configure speech parameters  
    speech_params = {  
        "enhance_speech": False, "max_ref_length": 60, "gpt_cond_len": 30, "gpt_cond_chunk_len": 4, "temperature": 0.75, "top_p": 0.85, "top_k": 50, "repetition_penalty": 20.0, "length_penalty": 1.0, "language": "en"}  
  
# Generate speech  
response = client.audio.speech.create(  
 model="xttsv2", voice=[audio_data], input=text, response_format="wav", speed=1.0, extra_body=speech_params)  
  
# Save the audio file  
response.write_to_file("output.wav")

Error Logs

\x03G\xb9\xb3\xd9\x00\xdf\x99\xa4\xc0\x93a{\xc8\x99\\\xf7\xc3\xba\xf2\x83\xc0\xbb\xb9\x92\xe2i\x9b_-\xfc\xc2D27\xe4\x86\xd3\xa3\xd8\xd4\xac\xe7\xe5\xb6\xa8b\xff\xa3Cm:\xce{[\xba\x80\x84S\xd9\xde\xb5\xa6\x0e\x94\x8e\\&\x93j\xec\xe5|\x18\xc4]\xae^\x11e\xf0\xa2%a\xe4\xd8\xb0\x8c\xefG\x10\x00\xd6{\x8aL\xf4\xb2\x16\x05\x99\x80\xbf\x0c\xcb]L\x7fn8\xdcJ\x9bt\xfc\x81\x01\x0e\x97\xa5\x80OggS\x00\x04x\xdd\x01\x00\x00\x00\x00\x00}7\x7fE,\x00\x00\x00\xe4*z\x80\x01TX\x03Nk\xc7(S\xb9\xe4\x8a\xd0A\xfe\xb4\n3\x9fM\xbf\x02\xa2\xf8\xf0\xbe\xd1}\x84\x13(5O\xb8M\xa2\xcc\xa7\xf0\xed\x8e\xa4\xc0)\x90\x0c\x87\x9bw\r\xb4\x90\x15F\xe3\xae\x18\x96,B\x07\x0c\xfao\xf0\x93\xf1m\x889R7\x9c\x80#D\x9e\xf3\xccy\x84m.\xaf\x80\xc0': System error.
@elvinzade elvinzade added the bug Something isn't working label Jan 14, 2025
@mlinmg mlinmg self-assigned this Jan 23, 2025
@mlinmg
Copy link
Contributor

mlinmg commented Jan 23, 2025

@elvinzade Can't seem to reproduce on my end, it works fine, have you tried with a fresh env?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants