fishaudio / fish-speech

Brand new TTS solution
https://speech.fish.audio
Other
14.62k stars 1.11k forks source link

/v1/asr endpoint seems not working in api #681

Open jenningsloy318 opened 8 hours ago

jenningsloy318 commented 8 hours ago

Self Checks

Cloud or Self Hosted

Self Hosted (Source)

Environment Details

running on debian 12 with cuda 12.4 launched via python tools/api.py

Steps to Reproduce

  1. run the api server
  2. try to post /v1/asr with
    
    from tools.schema import ServeASRRequest
    import requests
    import ormsgpack

def audio_to_bytes(file_path): with open(file_path, "rb") as wav_file: wav = wav_file.read() return wav

def fish_asr(base_url, audio_path): audio_bytes = audio_to_bytes(audio_path) data = { "audios": [audio_bytes], "language": "zh", "ignore_timestamps": "False", } pydantic_data = ServeASRRequest(**data)

request_data = ormsgpack.packb(
    pydantic_data, option=ormsgpack.OPT_SERIALIZE_PYDANTIC
)
max_retries = 2
for attempt in range(max_retries):
    try:
        response = requests.post(
            base_url,
            data=request_data,
            stream=True,
            headers={
                "Content-Type": "application/msgpack"
            }
        )

        if response.status_code == 200:
            response_data = response.content
            try:
                asr_response = ormsgpack.unpackb(
                    response_data, use_list=False)
                print("ASR Response:", asr_response)
            except Exception as e:
                print("Failed to decode response content:", e)
                print("Raw Response Content:", response_data)
        else:
            print(
                f"Failed to get a successful response from ASR service. Status code: {response.status_code}")
            print("Response content:", response.content)

    except Exception as e:
        print(f"An error occurred during the request: {e}")

if name == 'main': audio_path = './examples/8913957783621352198.wav' base_url = 'http://127.0.0.1:8080/v1/asr' fish_asr(base_url, audio_path)

from client side error message
```log
Failed to get a successful response from ASR service. Status code: 500
Response content: b'{"statusCode":500,"message":"name \'asr_model\' is not defined","error":"Internal Server Error"}'
Failed to get a successful response from ASR service. Status code: 500
Response content: b'{"statusCode":500,"message":"name \'asr_model\' is not defined","error":"Internal Server Error"}'

from api side, the error

Traceback (most recent call last):
  File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/exceptions.py", line 27, in wrapper
    return await endpoint()
  File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/views.py", line 29, in wrapper
    return await function()
  File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/parameters.py", line 117, in callback_with_auto_bound_params
    result = callback(*args, **{**keyword_params, **kwargs})
  File "/Apps/fish-speech/tools/api.py", line 369, in api_invoke_asr
    asr_model, audios=audios, sr=payload.sample_rate, language=payload.language
NameError: name 'asr_model' is not defined. Did you mean: 'vad_model'?
INFO:     127.0.0.1:44974 - "POST /v1/asr HTTP/1.1" 500 Internal Server Error
Traceback (most recent call last):
  File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/exceptions.py", line 27, in wrapper
    return await endpoint()
  File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/views.py", line 29, in wrapper
    return await function()
  File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/parameters.py", line 117, in callback_with_auto_bound_params
    result = callback(*args, **{**keyword_params, **kwargs})
  File "/Apps/fish-speech/tools/api.py", line 369, in api_invoke_asr
    asr_model, audios=audios, sr=payload.sample_rate, language=payload.language
NameError: name 'asr_model' is not defined. Did you mean: 'vad_model'?
INFO:     127.0.0.1:44980 - "POST /v1/asr HTTP/1.1" 500 Internal Server Error
Traceback (most recent call last):
  File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/exceptions.py", line 27, in wrapper
    return await endpoint()
  File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/views.py", line 29, in wrapper
    return await function()
  File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/parameters.py", line 117, in callback_with_auto_bound_params
    result = callback(*args, **{**keyword_params, **kwargs})
  File "/Apps/fish-speech/tools/api.py", line 369, in api_invoke_asr
    asr_model, audios=audios, sr=payload.sample_rate, language=payload.language
NameError: name 'asr_model' is not defined. Did you mean: 'vad_model'?
INFO:     127.0.0.1:47604 - "POST /v1/asr HTTP/1.1" 500 Internal Server Error
Traceback (most recent call last):
  File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/exceptions.py", line 27, in wrapper
    return await endpoint()
  File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/views.py", line 29, in wrapper
    return await function()
  File "Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/parameters.py", line 117, in callback_with_auto_bound_params
    result = callback(*args, **{**keyword_params, **kwargs})
  File /Apps/fish-speech/tools/api.py", line 369, in api_invoke_asr
    asr_model, audios=audios, sr=payload.sample_rate, language=payload.language
NameError: name 'asr_model' is not defined. Did you mean: 'vad_model'?
INFO:     127.0.0.1:47616 - "POST /v1/asr HTTP/1.1" 500 Internal Server Error

✔️ Expected Behavior

No response

❌ Actual Behavior

Traceback (most recent call last): File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/exceptions.py", line 27, in wrapper return await endpoint() File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/views.py", line 29, in wrapper return await function() File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/parameters.py", line 117, in callback_with_auto_bound_params result = callback(*args, {keyword_params, *kwargs}) File "/Apps/fish-speech/tools/api.py", line 369, in api_invoke_asr asr_model, audios=audios, sr=payload.sample_rate, language=payload.language NameError: name 'asr_model' is not defined. Did you mean: 'vad_model'? INFO: 127.0.0.1:44974 - "POST /v1/asr HTTP/1.1" 500 Internal Server Error Traceback (most recent call last): File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/exceptions.py", line 27, in wrapper return await endpoint() File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/views.py", line 29, in wrapper return await function() File "/Apps/fish-speech/venv/lib/python3.10/site-packages/kui/asgi/parameters.py", line 117, in callback_with_auto_bound_params result = callback(args, {keyword_params, **kwargs}) File "/Apps/fish-speech/tools/api.py", line 369, in api_invoke_asr asr_model, audios=audios, sr=payload.sample_rate, language=payload.language NameError: name 'asr_model' is not defined. Did you mean: 'vad_model'? INFO: 127.0.0.1:44980 - "POST /v1/asr HTTP/1.1" 500 Internal Server Error