    def translate(
        self,
        text: Union[str, List[str]],
        source: str,
        target: str,
        batch_size: int = 32,
        verbose: bool = False,
        generation_options: dict = None,
    ) -> Union[str, List[str]]:
        """
        *Translates a string or a list of strings from a source to a target language.*

        {{params}}
        {{text}} The content you want to translate.
        {{source}} The language of the original text.
        {{target}} The language of the translated text.
        {{batch_size}} The number of samples to load at once. If set to `None`, it will process everything at once.
        {{verbose}} Whether to display the progress bar for every batch processed.
        {{generation_options}} The keyword arguments passed to `model.generate()`, where `model` is the underlying transformers model.

        Note:
        - Run `print(dlt.utils.available_languages())` to see what's available.
        - A smaller value is preferred for `batch_size` if your (video) RAM is limited.
        """
        if generation_options is None:
            generation_options = {}

        source = _resolve_lang_codes(source, "source", self.model_family)
        target = _resolve_lang_codes(target, "target", self.model_family)

        self._tokenizer.src_lang = source

        original_text_type = type(text)
        if original_text_type is str:
            text = [text]

        if batch_size is None:
            batch_size = len(text)

        generation_options.setdefault(
            "forced_bos_token_id", self._tokenizer.convert_tokens_to_ids(target)
        )
        generation_options.setdefault("max_new_tokens", 512)

        data_loader = torch.utils.data.DataLoader(text, batch_size=batch_size)
        output_text = []

        tqdm_iterator = data_loader
        if verbose is True:
            tqdm_iterator = tqdm(data_loader)
        with torch.no_grad():
            for batch in tqdm_iterator:
                encoded = self._tokenizer(batch, return_tensors="pt", padding=True)
                encoded.to(self.device)

                generated_tokens = self._transformers_model.generate(
                    **encoded, **generation_options
                ).cpu()

                decoded = self._tokenizer.batch_decode(
                    generated_tokens, skip_special_tokens=True
                )

                output_text.extend(decoded)

        # If text: str and output_text: List[str], then we should convert output_text to str
        if original_text_type is str and len(output_text) == 1:
            output_text = output_text[0]

        return output_text
*Translates a string or a list of strings from a source to a target language.*

{{params}}
{{text}} The content you want to translate.
{{source}} The language of the original text.
{{target}} The language of the translated text.
{{batch_size}} The number of samples to load at once. If set to `None`, it will process everything at once.
{{verbose}} Whether to display the progress bar for every batch processed.
{{generation_options}} The keyword arguments passed to `model.generate()`, where `model` is the underlying transformers model.

Note:
- Run `print(dlt.utils.available_languages())` to see what's available.
- A smaller value is preferred for `batch_size` if your (video) RAM is limited.
dl_translate/_translation_model.py