refactor: unify names of the feature field of MultimodalDataItem (#8075)

This commit is contained in:
Mick
2025-07-16 17:52:38 -07:00
committed by GitHub
parent c28ad1990d
commit 4395c87a9b
33 changed files with 66 additions and 83 deletions
@@ -5,7 +5,6 @@ import multiprocessing as mp
import os
import re
from abc import ABC, abstractmethod
from functools import lru_cache
from typing import Any, Dict, List, Optional, Tuple, Union
import numpy as np
@@ -156,6 +155,10 @@ class BaseMultimodalProcessor(ABC):
# "precomputed_features" - handled specially as it can be any modality
}
# name of the feature filed
# TODO: pass from processors
self.FEATURE_NAMES = ["pixel_values", "pixel_values_videos", "audio_features"]
def process_mm_data(
self, input_text, images=None, videos=None, audios=None, **kwargs
):
@@ -524,6 +527,9 @@ class BaseMultimodalProcessor(ABC):
if modality not in items:
items[modality] = MultimodalDataItem(modality=modality)
if attr_name in self.FEATURE_NAMES:
attr_name = "feature"
# Set attribute
setattr(items[modality], attr_name, value)