-
Notifications
You must be signed in to change notification settings - Fork 45
Home
Welcome to the gpt-subtrans wiki!
The easiest and most flexible way to use gpt-subtrans is with the GUI, gui-subtrans. See the readme for installation and setup instructions.
gpt-subtrans takes subtitles in a source language, divides them up into batches (grouped into scenes) and politely asks ChatGPT to translate them to the target language.
It then attempts to extract the translated lines from ChatGPT's response and map them to the source file. Basic validation is applied to the translation to check for some of the errors ChatGPT tends to introduce, and if any are found a reply is sent noting the issues and asking ChatGPT to try again. Nine times out of ten it is able to correct its mistakes when they are pointed out.
Each batch is treated as a new conversation, with some details condensed from preceding batches to try to help ChatGPT understand the context of the lines it is translating. Additional context for the translation can be provided via project options, e.g. a short synopsis of the film and names of major characters.
The translation requests are constructed from the file instructions.txt
(unless overridden), they have been tweaked to try to minimise the chances of ChatGPT desyncing or going off the rails and inventing its own plot. The prompts used for the translation are quite rigid, using an xml-like syntax that helps ChatGPT understand the request and provide a structured response that can be parsed for the translations. There is sure to be further room for improvement.
Whilst ChatGPT's ability to understand context marks a significant advance over other machine-translation tools, it is still far short of what a professional translator would produce. The intention is not to replace translators but to open up accessibility to films and shows that have been denied a professional translation. The goal is that the result should be good enough to allow you to follow the film, but it is likely many manual corrections will be needed if you want to share the translation more widely.
Apart from anything else, Chat GPT does not actually watch the video so it is wholly reliant on the quality of the source subtitles, and will still make mistakes about who is speaking or misinterpret a remark that needs visual context.
I recommend passing the output through Subtitle Edit's "Fix Common Errors" function, which can automatically fix things like line breaks and short durations to make the subtitles more readable.
The answer is a very heavy "it depends". Firstly, if you are using a free/trial OpenAI account requests are severely restricted (three per minute at the time of writing, it seems to keep going down). Each batch of subtitles is one request, as are any retranslations or retries, so it's probably going to take hours to translate an average movie.
Paid accounts are much less restricted, though for the first 48 hours after signing up the rate limit is still somewhat restricted (after that there is a limit, but you are very unlikely to hit it with gpt-subtrans).
For users on a paid account the limiting factor will be how long ChatGPT takes to respond, which varies considerably depending on load and the size of a request. It might still only manage a few batches a minute, but whilst batches in a scene are always processed in sequence, multiple scenes can be processed in parallel (this can currently only be done in the GUI).
Cost depends on:
- How many lines of subtitles?
- How many batch requests?
- Which model is used as the translator?
For an average movie of up to 1,000 lines of dialogue, translation with gpt-3.5-turbo should cost between $0.20 and $0.50. With GPT4 the cost is approximately ten times higher.
For most users the gpt-3.5-turbo-16k model is probably the best choice, as it is fast and cheap and supports a larger batch size (around 100 lines for average movie dialogue).
The cost per token is somewhat higher than the smaller models, but since it can handle much larger batches it can generally translate the whole file with fewer requests, reducing the overhead of the instruction prompt sent for each request. If the source material is naturally composed of small batches it will end up costing more, and the lower per-token cost of the original gpt-3.5-turbo model may be more economical.
The application also supports the gpt-instruct model, which is fine-tuned for following instructions rather than conversation. In theory this could produce better translations, in practise the difference is hard to qualify - some lines come out better, some come out worse. Since it only supports the smaller 4k token window and has a higher per-token cost, I don't particularly recommend using it.
gpt-4 is better at understanding and summarizing content and has a better grasp of nuance and tone, so it may produce better translations of some material. In most cases the difference is likely to be minimal, so at ten times the cost it is probably better to save this model for selective retranslations when gpt-3.5-turbo is confused.
All subtitles need to be sent to OpenAI's servers for processing, so don't use the app to translate anything you wouldn't want to be used in future GPT training data.
I make absolutely no guarantees about the accuracy or suitability of the translations it produces, and I can't guarantee that the app won't do something catastrophically stupid with your data so please make sure you have backups or (preferably) work on a copy you can afford to lose. This is not a professional product and does not come with any sort of warranties or guarantee.
It's a good idea to regularly make copies of the project file when you've invested significant time or money into translating a section, as you would not be the first person to have it become irretrievably corrupted.
Report any issues here on github and I'll do my best to investigate them. Even better, fix them yourself and create a pull request!
If there are any features or changes that would make the app easier to use or more effective the same logic applies.
Spread the word if you find gpt-subtrans helpful, or at least unhelpful in interesting ways.