Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MODEL] support minicpm-o 2.6 #1116

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gptqmodel/models/_const.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def get_best_device(backend: BACKEND = BACKEND.AUTO) -> torch.device:
"cohere2",
"minicpm",
"minicpm3"
"minicpmo"
"qwen2_moe",
"qwen2_vl",
"dbrx_converted",
Expand Down
4 changes: 3 additions & 1 deletion gptqmodel/models/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
from .definitions.longllama import LongLlamaGPTQ # noqa: E402
from .definitions.minicpm import MiniCPMGPTQ # noqa: E402
from .definitions.minicpm3 import MiniCPM3GPTQ # noqa: E402
from .definitions.minicpmo import MiniCPMOGPTQ # noqa: E402
from .definitions.mistral import MistralGPTQ # noqa: E402
from .definitions.mixtral import MixtralGPTQ # noqa: E402
from .definitions.mllama import MLlamaGPTQ # noqa: E402
Expand Down Expand Up @@ -126,7 +127,8 @@
"phi3": Phi3GPTQ,
"mpt": MPTGPTQ,
"minicpm": MiniCPMGPTQ,
"minicpm3":MiniCPM3GPTQ,
"minicpm3": MiniCPM3GPTQ,
"minicpmo": MiniCPMOGPTQ,
"qwen2_moe": Qwen2MoeGPTQ,
"qwen2_vl": Qwen2VLGPTQ,
"dbrx": DbrxGPTQ,
Expand Down
1 change: 1 addition & 0 deletions gptqmodel/models/definitions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from .llama import LlamaGPTQ
from .longllama import LongLlamaGPTQ
from .minicpm3 import MiniCPM3GPTQ
from .minicpmo import MiniCPMOGPTQ
from .mistral import MistralGPTQ
from .mixtral import MixtralGPTQ
from .mllama import MLlamaGPTQ
Expand Down
29 changes: 29 additions & 0 deletions gptqmodel/models/definitions/minicpmo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2025 ModelCloud
# Contact: [email protected], x.com/qubitium
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ..base import BaseGPTQModel


class MiniCPMOGPTQ(BaseGPTQModel):
layer_type = "Qwen2DecoderLayer"
layers_node = "llm.model.layers"
base_modules = ["llm.model.embed_tokens", "llm.model.norm", "vpm", "apm", "tts", "audio_projection_layer",
"resampler"]
layer_modules = [
["self_attn.k_proj", "self_attn.v_proj", "self_attn.q_proj"],
["self_attn.o_proj"],
["mlp.up_proj", "mlp.gate_proj"],
["mlp.down_proj"],
]