class_docstr: Transformers handler class for  MMFTransformerWithVideoAudio model.
class_docstr_tok: ["Transformers","handler","class","for","MMFTransformerWithVideoAudio","model","."]
docstr: Preprocessing, based on processor defined for MMF model.
              
docstr_tok: ["Preprocessing",",","based","on","processor","defined","for","MMF","model","."]
code: def preprocess(self, requests):
      """Preprocessing, based on processor defined for MMF model."""
  
      def create_sample(
          video_transfomred, audio_transfomred, text_tensor, video_label
      ):
          label = [self.class_to_idx[l] for l in video_label]
  
          one_hot_label = torch.zeros(len(self.class_to_idx))
          one_hot_label[label] = 1
  
          current_sample = Sample()
          current_sample.video = video_transfomred
          current_sample.audio = audio_transfomred
          current_sample.update(text_tensor)
          current_sample.targets = one_hot_label
          current_sample.dataset_type = "test"
          current_sample.dataset_name = "charades"
          return SampleList([current_sample]).to(self.device)
  
      for idx, data in enumerate(requests):
          raw_script = data.get("script")
          script = raw_script.decode("utf-8")
          raw_label = data.get("labels")
          video_label = raw_label.decode("utf-8")
          video_label = [video_label]
  
          video = io.BytesIO(data["data"])
          video_tensor, audio_tensor, info = torchvision.io.read_video(
              video
          )
          text_tensor = self.processor["text_processor"](
              {"text": script}
          )
          video_transformed = self.processor["video_test_processor"](
              video_tensor
          )
          audio_transformed = self.processor["audio_processor"](
              audio_tensor
          )
          samples = create_sample(
              video_transformed,
              audio_transformed,
              text_tensor,
              video_label,
          )
  
      return samples
  
imports: import json
  import logging
  import os
  import pickle
  import sys
  import ast
  import torch
  from ts.torch_handler.base_handler import BaseHandler
  import io
  import torchaudio
  import torchvision
  from omegaconf import OmegaConf
  import pandas
  import csv
  from torchvision import transforms
  from torchvision.datasets.vision import VisionDataset
  from torchvision.io import read_video_timestamps, read_video
  from mmf.common.sample import Sample, SampleList
  from mmf.utils.env import set_seed, setup_imports
  from mmf.utils.logger import setup_logger, setup_very_basic_config
  from mmf.datasets.base_dataset import BaseDataset
  from mmf.utils.build import build_encoder, build_model, build_processors
  from mmf.datasets.mmf_dataset_builder import MMFDatasetBuilder
  from torch.utils.data import IterableDataset
  from mmf.utils.configuration import load_yaml
  from mmf.models.mmf_transformer import MMFTransformer
label_desc: Use image node_id 3 for calling the MMFHandler obj's underlying member method code with example usage: obj.preprocess(requests) and returns: samples, SampleList