mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2026-08-17 13:35:44 +08:00
[model] support MiniCPM-V-4.6 (#10472)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
import copy
|
||||
import inspect
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional
|
||||
|
||||
@@ -474,6 +475,13 @@ class MultiModalDataCollatorForSeq2Seq(DataCollatorForSeq2Seq):
|
||||
features["position_ids"] = torch.arange(seq_length).long().repeat(bsz, 1)
|
||||
return {"data": features, "input_ids": features["input_ids"], "labels": features["labels"]}
|
||||
|
||||
if (
|
||||
self.model is not None
|
||||
and getattr(self.model.config, "model_type", None) == "minicpmv4_6"
|
||||
and "target_sizes" in features
|
||||
): # for minicpmv4_6 with new transformers (NaViT API, no image_bound)
|
||||
features["downsample_mode"] = os.getenv("DOWNSAMPLE_MODE", "16x")
|
||||
|
||||
return features
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user