docstr: Generate input batches.
docstr_tok: ["Generate","input","batches","."]
code: def _batchify(self, data: List[str], batch_size: int):
      """
      Generate input batches.
      """
      phone_pad_func = Pad(voc_phones.lookup(phone_pad_token))
      tone_pad_func = Pad(voc_tones.lookup(tone_pad_token))
  
      def _parse_batch(batch_data):
          phones, tones = zip(*batch_data)
          speaker_embeddings = paddle.expand(
              self._speaker_embedding, shape=(len(batch_data), -1)
          )
          return (
              phone_pad_func(phones),
              tone_pad_func(tones),
              speaker_embeddings,
          )
  
      examples = []  # [(phones, tones), ...]
      for text in data:
          examples.append(self._convert_text_to_input(text))
  
      # Seperates data into some batches.
      one_batch = []
      for example in examples:
          one_batch.append(example)
          if len(one_batch) == batch_size:
              yield _parse_batch(one_batch)
              one_batch = []
      if one_batch:
          yield _parse_batch(one_batch)
  
imports: import importlib
  import os
  from typing import List
  import numpy
  import paddle
  import paddle.nn
  from paddlehub.env import MODULE_HOME
  from paddlehub.module.module import moduleinfo
  from paddlehub.utils.log import logger
  from paddlenlp.data import Pad
  from parakeet.models import ConditionalWaveFlow, Tacotron2
  from parakeet.models.lstm_speaker_encoder import LSTMSpeakerEncoder
  import soundfile
  from .audio_processor import SpeakerVerificationPreprocessor
  from .chinese_g2p import convert_sentence
  from .preprocess_transcription import voc_phones, voc_tones, phone_pad_token, tone_pad_token
label_desc: Use image node_id 6 for calling the VoiceCloner obj's underlying member method code with example usage: obj._batchify(data, batch_size) and returns: phone_pad_func,  tone_pad_func,  speaker_embeddings