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] Type is not msgpack serializable: TTSRequest #5

Closed
talongao opened this issue Nov 28, 2024 · 4 comments
Closed

[BUG] Type is not msgpack serializable: TTSRequest #5

talongao opened this issue Nov 28, 2024 · 4 comments

Comments

@talongao
Copy link

I am encountering issues while attempting to use the SDK for Text-to-Speech (TTS). Despite following the provided documentation and examples, I am unable to successfully generate speech from text.

Steps to Reproduce:

  1. Setup Environment:

    • Operating System: Ubuntu 20.04
    • SDK Version: 2024.10.22
    • Programming Language: Python 3.10.15
  2. Code Snippet:

from fish_audio_sdk import Session, TTSRequest

def main():
    f = None
    if result_path is not None:
        f = open(result_path, "wb")
    for chunk in self.session.tts(
        TTSRequest(text=text, reference_id=voice_id, format=audio_format)
    ):
        if f is not None:
            f.write(chunk)
            f.flush()
        elif result_array is not None:
            result_array.extend(chunk)

if __name__ == "__main__":
    main()
  1. Expected Behavior:
  • The SDK should successfully synthesize the provided text into speech and return an audio stream.
  1. Actual Behavior:
  • raise Exception: TypeError('Type is not msgpack serializable: TTSRequest')
@talongao
Copy link
Author

talongao commented Nov 28, 2024

It does not work in version 2024.11.28 either.

@abersheeran
Copy link
Collaborator

aviramha/ormsgpack#311

@talongao
Copy link
Author

Thanks

@abersheeran abersheeran pinned this issue Nov 29, 2024
@abersheeran abersheeran changed the title Unable to Use SDK for TTS [BUG] Type is not msgpack serializable: TTSRequest Nov 29, 2024
@talongao
Copy link
Author

The ormsgpack is still at version 1.6.0. If you are using pydantic >= 2.10.0, you can temporarily replace TTSRequest with a dict.It's work.

for chunk in self.session.tts(dict(text=text, reference_id=voice_id, format=audio_format)):
    f.write(chunk)
    f.flush()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants