Closed morris-y closed 1 year ago
Thanks for your feedback. j comes from batch_p, batch_p is the input of the translate method, the length of translated_batch should be consistent, and there will be no list index out of range. It should be that when translate_batch executes the translate method, the number of translation results obtained is inconsistent with the number of batch_p. The possible reason is that when translating, the GPT API does not return as required. If you have a more specific example, we will be able to more accurately locate the problem.
Thx for your advice. I tried with lemo.epub (text_books) two times lead to the same IndexError. Seems like a GPT API problem, will look into that direction.
I confirmed this problem, the structure we use when accessing openai is [a,b,c...], but occasionally openai will not return the [a,b,c...] structure as we expected , will use the [ab,c,...] structure, which will cause the array index to access out of bounds, and I will fix it later.
The updated batch_p section has been tested without any issues and the translation has been successful. Thank you for keeping up the great work.
Any suggestions on this?
File "R:\...\make.py", line 148, in <module> e.translate_book()
File "R:\...\make.py", line 100, in translate_book c_p.string = c_p.text + translated_batch[j] IndexError: list index out of range