mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
21 lines
552 B
Python
21 lines
552 B
Python
import torch
|
|
|
|
class IdentityMap(torch.nn.Module):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
def forward(self, x, *args, **kwargs):
|
|
return x
|
|
|
|
@property
|
|
def config(self):
|
|
return {"mm_resampler_type": None}
|
|
|
|
def build_vision_resampler(model_args, delay_load=False, **kwargs):
|
|
# import pdb;pdb.set_trace()
|
|
resampler_type = getattr(model_args, 'mm_resampler_type', None)
|
|
if resampler_type is None:
|
|
return IdentityMap()
|
|
else:
|
|
raise ValueError(f'Unknown resampler type: {resampler_type}')
|