def predict(
            self,
            sentences: List[str],
            skip_prompt: bool = True,
            prompt_template_name: str = None,
            max_length: int = None,
            do_sample: bool = None,
            temperature: float = None,
            repetition_penalty: float = None,
            eval_batch_size: int = None,
            system_prompt: str = None,
            **kwargs
    ) -> List[str]:
        """
        Performs predictions on a list of text.

        Args:
            sentences: A python list of text (str) to be sent to the model for prediction. Note that the prefix should be prepended to the text.
            skip_prompt: Whether to skip the prompt when generating text.
            prompt_template_name: The name of the prompt template to use.
            max_length: The maximum length of the generated text.
            do_sample: Whether or not to use sampling ; use greedy decoding otherwise.
            temperature: The value used to module the next token probabilities.
            repetition_penalty: The parameter for repetition penalty. 1.0 means no penalty.
            eval_batch_size: Batch size to use for evaluation.
            system_prompt: The system prompt to use for generation.
            **kwargs: Additional arguments for generating sequences.

        Returns:
            preds: A python list of the generated sequences.
        """  # noqa: ignore flake8"

        self.model.eval()
        if self.args.fp16:
            self.model.half()
        prompt_template = get_conv_template(prompt_template_name or self.args.prompt_template_name)
        if not eval_batch_size:
            eval_batch_size = self.args.eval_batch_size

        all_outputs = []
        # Batching
        for batch in tqdm(
                [
                    sentences[i: i + eval_batch_size]
                    for i in range(0, len(sentences), eval_batch_size)
                ],
                desc="Generating outputs",
                disable=self.args.silent,
        ):
            generation_kwargs = dict(
                max_new_tokens=max_length if max_length is not None else self.args.max_length,
                do_sample=do_sample if do_sample is not None else self.args.do_sample,
                temperature=temperature if temperature is not None else self.args.temperature,
                repetition_penalty=repetition_penalty if repetition_penalty is not None else self.args.repetition_penalty,
            )

            if prompt_template_name:
                prompts = [prompt_template.get_prompt(messages=[[s, '']], system_prompt=system_prompt) for s in batch]
                inputs = self.tokenizer(prompts, padding=True, return_tensors='pt')
                input_ids = inputs['input_ids'].to(self.device)
                outputs = self.model.generate(input_ids, **generation_kwargs, **kwargs)
            else:
                conversation = []
                for s in batch:
                    messages = []
                    if system_prompt:
                        messages.append({'role': 'system', 'content': system_prompt})
                    messages.append({'role': 'user', 'content': s})
                    conversation.append(messages)
                inputs = self.tokenizer.apply_chat_template(
                    conversation=conversation,
                    tokenize=True,
                    add_generation_prompt=True,
                    return_tensors='pt',
                    padding=True,
                )
                input_ids = inputs.to(self.device)
                outputs = self.model.generate(input_ids, **generation_kwargs, **kwargs)

            for input_text, generated_sequence in zip(batch, outputs):
                # Decode text
                prompt_len = len(input_ids[0])
                generated_sequence = generated_sequence[prompt_len:]
                gen_text = self.tokenizer.decode(generated_sequence, skip_special_tokens=True)
                gen_text = gen_text.strip()
                # logger.debug(f"input_text: {input_text}, gen_text: {gen_text}")
                all_outputs.append(gen_text)

        return all_outputs

        Performs predictions on a list of text.

        Args:
            sentences: A python list of text (str) to be sent to the model for prediction. Note that the prefix should be prepended to the text.
            skip_prompt: Whether to skip the prompt when generating text.
            prompt_template_name: The name of the prompt template to use.
            max_length: The maximum length of the generated text.
            do_sample: Whether or not to use sampling ; use greedy decoding otherwise.
            temperature: The value used to module the next token probabilities.
            repetition_penalty: The parameter for repetition penalty. 1.0 means no penalty.
            eval_batch_size: Batch size to use for evaluation.
            system_prompt: The system prompt to use for generation.
            **kwargs: Additional arguments for generating sequences.

        Returns:
            preds: A python list of the generated sequences.
        
pycorrector/gpt/gpt_model.py