code: def _extract_features(video_pipeline, audio_pipeline, samples, args):
      raw_videos = []
      raw_audios = []
      for sample in samples:
          if args.modality == "video":
              raw_videos.append(sample[0])
          if args.modality == "audio":
              raw_audios.append(sample[0])
          if args.modality == "audiovisual":
              length = min(len(sample[0]) // 640, len(sample[1]))
              raw_audios.append(sample[0][: length * 640])
              raw_videos.append(sample[1][:length])
  
      if args.modality == "video" or args.modality == "audiovisual":
          videos = torch.nn.utils.rnn.pad_sequence(
              raw_videos, batch_first=True
          )
          videos = video_pipeline(videos)
          video_lengths = torch.tensor(
              [elem.shape[0] for elem in videos], dtype=torch.int32
          )
      if args.modality == "audio" or args.modality == "audiovisual":
          audios = torch.nn.utils.rnn.pad_sequence(
              raw_audios, batch_first=True
          )
          audios = audio_pipeline(audios)
          audio_lengths = torch.tensor(
              [elem.shape[0] // 640 for elem in audios],
              dtype=torch.int32,
          )
      if args.modality == "video":
          return videos, video_lengths
      if args.modality == "audio":
          return audios, audio_lengths
      if args.modality == "audiovisual":
          return audios, videos, audio_lengths, video_lengths
  
imports: import random
  from typing import List
  import sentencepiece
  import torch
  import torchvision
  from data_module import LRS3DataModule
  from lightning import Batch
  from lightning_av import AVBatch
label_desc: Use image node_id 2 for calling a global function with example usage: _extract_features(video_pipeline, audio_pipeline, samples, args) and returns: videos,  video_lengths, audios,  audio_lengths, audios,  videos,  audio_lengths,  video_lengths