File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: Apache-2.0
44# Contact: qubitium@modelcloud.ai, x.com/qubitium
55
6+ # Adapted from intel/auto-round
7+ # at https://github.com/intel/auto-round/blob/main/auto_round/logger.py
8+
69import logging
710
811logger = logging .getLogger ("defuser" )
Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: Apache-2.0
44# Contact: qubitium@modelcloud.ai, x.com/qubitium
55
6+ # Adapted from intel/auto-round
7+ # at https://github.com/intel/auto-round/blob/main/auto_round/modeling/fused_moe/moe_experts_interface.py
8+
69"""
710Custom experts implementation for transformers' MOE integration.
811
Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: Apache-2.0
44# Contact: qubitium@modelcloud.ai, x.com/qubitium
55
6+ # Adapted from intel/auto-round
7+ # at https://github.com/intel/auto-round/blob/main/auto_round/modeling/fused_moe/qwen3_5_moe.py
8+
69import torch
710from torch .nn import functional as F
811
Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: Apache-2.0
44# Contact: qubitium@modelcloud.ai, x.com/qubitium
55
6+ # Adapted from intel/auto-round
7+ # at https://github.com/intel/auto-round/blob/main/auto_round/modeling/fused_moe/replace_modules.py
8+
69from abc import ABC , abstractmethod
710
811import torch
Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: Apache-2.0
44# Contact: qubitium@modelcloud.ai, x.com/qubitium
55
6+ # Adapted from intel/auto-round
7+ # at https://github.com/intel/auto-round/blob/main/auto_round/special_model_handler.py
8+
69from defuser .modeling .fused_moe .replace_modules import apply_replacements , release_original_module_
710
811
Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: Apache-2.0
44# Contact: qubitium@modelcloud.ai, x.com/qubitium
55
6+ # Adapted from intel/auto-round
7+ # at https://github.com/intel/auto-round/blob/main/auto_round/modeling/unfused_moe/qwen3_moe.py
8+
69import torch
710import torch .nn as nn
811from torch .nn import functional as F
Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: Apache-2.0
44# Contact: qubitium@modelcloud.ai, x.com/qubitium
55
6+ # Adapted from intel/auto-round
7+ # at https://github.com/intel/auto-round/blob/main/auto_round/utils/common.py
8+
69import importlib
710from functools import lru_cache
811
Original file line number Diff line number Diff line change 22# SPDX-FileCopyrightText: 2026 qubitium@modelcloud.ai
33# SPDX-License-Identifier: Apache-2.0
44# Contact: qubitium@modelcloud.ai, x.com/qubitium
5+
6+ # Adapted from intel/auto-round
7+ # at https://github.com/intel/auto-round/blob/main/auto_round/utils/device.py
8+
59import gc
610
711import torch
Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: Apache-2.0
44# Contact: qubitium@modelcloud.ai, x.com/qubitium
55
6- import traceback
6+ # Adapted from intel/auto-round
7+ # at https://github.com/intel/auto-round/blob/main/auto_round/modeling/unfused_moe/__init__.py
78
89import torch
9- from torch import nn
1010
1111from packaging import version
1212
@@ -142,7 +142,6 @@ def apply_modeling_patch(model: torch.nn.Module) -> bool:
142142 logger .info (f"Patched module: { orig_path } -> { custom_path } " )
143143 return True
144144 except Exception as e :
145- traceback .print_exc ()
146145 logger .warning (f"Failed to patch { orig_path } : { e } " )
147146 return False
148147 return False
Original file line number Diff line number Diff line change 33# SPDX-License-Identifier: Apache-2.0
44# Contact: qubitium@modelcloud.ai, x.com/qubitium
55
6+ # Adapted from intel/auto-round
7+ # at https://github.com/intel/auto-round/blob/main/auto_round/utils/model.py
8+
69import torch
710
811
You can’t perform that action at this time.
0 commit comments