nvidia-riva / nvidia-riva/python-clients

AttributeError on custom_dictionary in tts.synthesize() since version 2.17

Open
#100 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
142
Forks
52
PR merge metrics
No merged PRs in 30d

Description

``Since version 2.17, an AttributeError occurs when using the tts.synthesize() method in the riva.client.tts module. It seems that the custom_dictionary parameter is None by default, which causes the function add_custom_dictionary_to_config to fail when attempting to access .items().

/home/rodrigo/Proyectos/marta/Call-Services/venv/bin/python /home/rodrigo/Proyectos/marta/Call-Services/test/performance_test/testNvidiaRivaTTS.py 
/home/rodrigo/Proyectos/marta/Call-Services/test/performance_test/testNvidiaRivaTTS.py:16: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13
  import audioop
Traceback (most recent call last):
  File "/home/rodrigo/Proyectos/marta/Call-Services/test/performance_test/testNvidiaRivaTTS.py", line 169, in <module>
    for transformed_audio in ulaw_response_audio_stream:
  File "/home/rodrigo/Proyectos/marta/Call-Services/test/performance_test/testNvidiaRivaTTS.py", line 152, in wav_converter
    for raw_wav in raw_stream:
  File "/home/rodrigo/Proyectos/marta/Call-Services/test/performance_test/testNvidiaRivaTTS.py", line 130, in generate_audio
    resp = tts_service.synthesize(**req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rodrigo/Proyectos/marta/Call-Services/venv/lib/python3.11/site-packages/riva/client/tts.py", line 91, in synthesize
    add_custom_dictionary_to_config(req, custom_dictionary)
  File "/home/rodrigo/Proyectos/marta/Call-Services/venv/lib/python3.11/site-packages/riva/client/tts.py", line 15, in add_custom_dictionary_to_config
    result_list = [f"{key}  {value}" for key, value in custom_dictionary.items()]
                                                       ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'items'

As a temporary workaround, the issue can be avoided by passing an empty dictionary as custom_dictionary={} in the request.

Please take more care with releases to avoid breaking changes like this in the future.

Thank you!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with riva/client/tts.py, especially synthesize() and add_custom_dictionary_to_config(), using the traceback and the request that omits custom_dictionary. Reproduce the failure with tts.synthesize() and verify that the call succeeds without the workaround of passing custom_dictionary={}.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.