code: def main(args):
      dense_model, quantizer_model, vocab = (
          "mhubert-base-25hz",
          "kmeans",
          500,
      )
  
      # Load speech encoder and vocoder
      encoder = SpeechEncoder.by_name(
          dense_model_name=dense_model,
          quantizer_model_name=quantizer_model,
          vocab_size=vocab,
          deduplicate=True,
          need_f0=False,
          add_bos_eos=False,
      ).eval()
  
      vocoder = CodeHiFiGANVocoder.by_name(
          dense_model_name=dense_model,
          quantizer_model_name=quantizer_model,
          vocab_size=vocab,
      ).eval()
  
      if torch.cuda.is_available():
          encoder = encoder.cuda()
          vocoder = vocoder.cuda()
  
      # Load twist model
      twist_model = build_speech_lm(args.twist_model_name)
  
      audio, sample_rate = torchaudio.load(args.input_file)
      if audio.ndim == 2:
          audio = audio.mean(0)
  
      if args.prompt_duration_sec:
          prompt = int(args.prompt_duration_sec * sample_rate)
          audio = audio[:prompt]
  
      generated_audio = run_full_generation(
          encoder, twist_model, vocoder, audio
      )
  
      torchaudio.save(
          args.output_file,
          generated_audio.cpu().unsqueeze(0),
          16000,
      )
  
file_path: textlesslib/examples/twist/twist_generation.py
imports: import torchaudio
  import torch
  from speech_lm import generate_with_offset, build_speech_lm
  from textless.vocoders.hifigan.vocoder import CodeHiFiGANVocoder
  from textless.data.speech_encoder import SpeechEncoder
label_desc: Use image node_id 2 for calling a global function with example usage: main(args) without return types