If I use Notebook or Default mode, the whole text is sent to Translator at once. Google translate can only translate 5000 characters at once and the plugin doesn't handle that. There should be some fix for this (for example, it chops up to the sentence before 5000 characters and creates a packet, then the rest, and finally translates one packet at a time).
Is there an existing issue for this?
[X] I have searched the existing issues
Reproduction
Type a longer text in any language in RAW mode, turn on Translate and generate.
Screenshot
No response
Logs
Traceback (most recent call last):
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\gradio\queueing.py", line 407, in call_prediction
output = await route_utils.call_process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\gradio\route_utils.py", line 226, in call_process_api
output = await app.get_blocks().process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\gradio\blocks.py", line 1550, in process_api
result = await self.call_function(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\gradio\blocks.py", line 1199, in call_function
prediction = await utils.async_iteration(iterator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\gradio\utils.py", line 519, in async_iteration
return await iterator.__anext__()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\gradio\utils.py", line 512, in __anext__
return await anyio.to_thread.run_sync(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\anyio\_backends\_asyncio.py", line 2134, in run_sync_in_worker_thread
return await future
^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\anyio\_backends\_asyncio.py", line 851, in run
result = context.run(func, *args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\gradio\utils.py", line 495, in run_sync_iterator_async
return next(iterator)
^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\gradio\utils.py", line 649, in gen_wrapper
yield from f(*args, **kwargs)
File "I:\oobabooga_windows\text-generation-webui\modules\text_generation.py", line 182, in generate_reply_wrapper
for reply in generate_reply(question, state, stopping_strings, is_chat=False, escape_html=True):
File "I:\oobabooga_windows\text-generation-webui\modules\text_generation.py", line 30, in generate_reply
for result in _generate_reply(*args, **kwargs):
File "I:\oobabooga_windows\text-generation-webui\modules\text_generation.py", line 55, in _generate_reply
question = apply_extensions('input', question, state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\modules\extensions.py", line 224, in apply_extensions
return EXTENSION_MAP[typ](*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\modules\extensions.py", line 82, in _apply_string_extensions
text = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\extensions\google_translate\script.py", line 22, in input_modifier
return GoogleTranslator(source=params['language string'], target='en').translate(string)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\deep_translator\google.py", line 55, in translate
if is_input_valid(text):
^^^^^^^^^^^^^^^^^^^^
File "I:\oobabooga_windows\text-generation-webui\installer_files\env\Lib\site-packages\deep_translator\validate.py", line 20, in is_input_valid
raise NotValidLength(text, min_chars, max_chars)
deep_translator.exceptions.NotValidLength
Describe the bug
If I use Notebook or Default mode, the whole text is sent to Translator at once. Google translate can only translate 5000 characters at once and the plugin doesn't handle that. There should be some fix for this (for example, it chops up to the sentence before 5000 characters and creates a packet, then the rest, and finally translates one packet at a time).
Is there an existing issue for this?
Reproduction
Type a longer text in any language in RAW mode, turn on Translate and generate.
Screenshot
No response
Logs
System Info