nemo_curator.stages.text.experimental.translation.stages.translate
nemo_curator.stages.text.experimental.translation.stages.translate
Translate segmented text with an LLM or external backend.
Module Contents
Classes
API
Bases: ProcessingStage[DocumentBatch, DocumentBatch]
Translate segments emitted by :class:SegmentationStage.
Reads _seg_segments and writes _translated.
If True, skip actual translation and return empty strings.
Number of example prompts to log when dry_run is enabled.
If True, verify the translation backend is reachable during setup().
Return exception types handled at the backend boundary.
Build the prompt for one segment.
Invoke the configured non-LLM backend for one batch of segments.
Collect translatable segments and preserve passthrough segments.
Run the lightweight LLM health-check request.
Verify the translation backend is reachable.
Translate all segments concurrently.
Delegate translation to a non-LLM backend.
Fallback path that retries backend translation one segment at a time.
Translate segments with the async LLM client.
Extract translated text from the expected 〘...〙 wrapper.
Raise if the backend returned a different number of translations.
Write successful bulk backend outputs into result arrays.
Translate every segment in the batch.
Initialize the client or backend on the worker.