Skip to content

[Bug] Translation gets stuck (infinite loading) with DeepSeek API #1098

@aikaisou3-cmd

Description

@aikaisou3-cmd
Image

Version Info

Python version: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Python executable: F:\python\python.exe
Version: 1.4.0
Branch: dev
Commit hash: <8a10f03>

Description of the Problem

I am using the dev branch with DeepSeek API.
When I start the translation, it does not finish and looks like it is stuck in infinite loading.

The endpoint URL is not the issue. I have verified the URL, but the error persists regardless of the endpoint settings.

Here is the full log:

[DEBUG  ] trans_llm_api:_initialize_client:196 - Initializing client for OpenAI with key [my deepseek api key] at endpoint https://api.deepseek.com/v1
[DEBUG  ] trans_llm_api:_request_translation:426 - Using 'json_object' mode for OpenAI.
Traceback (most recent call last):
  File "F:\BallonsTranslator-dev\ui\module_manager.py", line 497, in run
    self.job()
  File "F:\BallonsTranslator-dev\ui\module_manager.py", line 311, in <lambda>
    self.job = lambda : self._blktrans_pipeline(blk_list, tgt_img, mode, blk_ids, tgt_mask)
  File "F:\BallonsTranslator-dev\ui\module_manager.py", line 323, in _blktrans_pipeline
    self.translate_thread.module.translate_textblk_lst(blk_list)
  File "F:\BallonsTranslator-dev\modules\translators\base.py", line 202, in translate_textblk_lst
    _translations = self.translate(text_list)
  File "F:\BallonsTranslator-dev\modules\translators\base.py", line 149, in translate
    text_trans = self._translate(text_source)
  File "F:\BallonsTranslator-dev\modules\translators\trans_llm_api.py", line 536, in _translate
    parsed_response = self._request_translation(prompt)
  File "F:\BallonsTranslator-dev\modules\translators\trans_llm_api.py", line 440, in _request_translation
    completion.choices
AttributeError: 'str' object has no attribute 'choices'


system_prompt :
You are an expert translator. Your task is to accurately translate the given text snippets. You MUST provide the output strictly in the specified JSON format, without any additional explanations or markdown formatting. The JSON object must have a single key 'translations', which is a list of objects, each with an 'id' (integer) and a 'translation' (string).

Example Output Schema:
{"translations": [{"id": 1, "translation": "Translated text here."}]}

### Text Detector

None

### OCR

None

### Inpaint

None

### Translator

None

### Screenshot

_No response_

### Logs

```shell
[DEBUG  ] trans_llm_api:_initialize_client:196 - Initializing client for OpenAI with key [my deepseek api key] at endpoint https://api.deepseek.com/v1
[DEBUG  ] trans_llm_api:_request_translation:426 - Using 'json_object' mode for OpenAI.
Traceback (most recent call last):
  File "F:\BallonsTranslator-dev\ui\module_manager.py", line 497, in run
    self.job()
  File "F:\BallonsTranslator-dev\ui\module_manager.py", line 311, in <lambda>
    self.job = lambda : self._blktrans_pipeline(blk_list, tgt_img, mode, blk_ids, tgt_mask)
  File "F:\BallonsTranslator-dev\ui\module_manager.py", line 323, in _blktrans_pipeline
    self.translate_thread.module.translate_textblk_lst(blk_list)
  File "F:\BallonsTranslator-dev\modules\translators\base.py", line 202, in translate_textblk_lst
    _translations = self.translate(text_list)
  File "F:\BallonsTranslator-dev\modules\translators\base.py", line 149, in translate
    text_trans = self._translate(text_source)
  File "F:\BallonsTranslator-dev\modules\translators\trans_llm_api.py", line 536, in _translate
    parsed_response = self._request_translation(prompt)
  File "F:\BallonsTranslator-dev\modules\translators\trans_llm_api.py", line 440, in _request_translation
    completion.choices
AttributeError: 'str' object has no attribute 'choices'

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions