refactor: unify names of the feature field of MultimodalDataItem (#8075)
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user