File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99from loguru import logger as eval_logger
1010from PIL import Image
1111from tqdm import tqdm
12- from transformers import AutoModelForVision2Seq , AutoProcessor , AutoTokenizer
12+ from transformers import AutoProcessor , AutoTokenizer , Gemma3ForConditionalGeneration
1313
1414from lmms_eval import utils
1515from lmms_eval .api .instance import Instance
@@ -71,14 +71,8 @@ def __init__(
7171 if attn_implementation is not None :
7272 model_kwargs ["attn_implementation" ] = attn_implementation
7373
74- # Try to load with AutoModelForVision2Seq which handles various vision-language models
75- try :
76- self ._model = AutoModelForVision2Seq .from_pretrained (pretrained , ** model_kwargs ).eval ()
77- except Exception :
78- # Fallback to a more generic approach if specific model class not found
79- from transformers import AutoModel
80-
81- self ._model = AutoModel .from_pretrained (pretrained , ** model_kwargs ).eval ()
74+ # Minimal, generation-capable loader: use the dedicated Gemma3 class
75+ self ._model = Gemma3ForConditionalGeneration .from_pretrained (pretrained , ** model_kwargs ).eval ()
8276 self ._tokenizer = AutoTokenizer .from_pretrained (pretrained , trust_remote_code = trust_remote_code , device_map = self .device_map )
8377 self .processor = AutoProcessor .from_pretrained (pretrained , max_pixels = max_pixels , min_pixels = min_pixels )
8478
You can’t perform that action at this time.
0 commit comments