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

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

Open
6 tasks done
jenningsloy318 opened this issue Nov 22, 2024 · 1 comment
Open
6 tasks done

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

jenningsloy318 opened this issue Nov 22, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@jenningsloy318
Copy link

Self Checks

  • This template is only for bug reports. For questions, please visit Discussions.
  • I have thoroughly reviewed the project documentation (installation, training, inference) but couldn't find information to solve my problem. English 中文 日本語 Portuguese (Brazil)
  • I have searched for existing issues, including closed ones. Search issues
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template and fill in all required fields.

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

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

@jenningsloy318 jenningsloy318 added the bug Something isn't working label Nov 22, 2024
@YoungWiller
Copy link

What kind of question is that? I use API in China, I can't use it without crossing the wall, it has been available before

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

3 participants