Skip to main content

Enhanced Mixture of Experts implementation with optimized Straight-Through Estimator router

Project description

DenseMixer

Enhanced Mixture of Experts implementation with optimized router for multiple MoE models.

Supported Models

  • Qwen3-MoE
  • Qwen2-MoE
  • OLMoE

Installation

pip install densemixer

Usage: Auto-Patching Setup (No Manual Import Needed)

To enable DenseMixer automatically for all Python scripts (without needing to add any import):

densemixer setup
export DENSEMIXER_ENABLED=1

This will append the necessary auto-import logic to your usercustomize.py in your user site-packages (if not already present). Any Python process with DENSEMIXER_ENABLED=1 will auto-load DenseMixer and patch transformers models.

To disable, either unset the environment variable or manually remove the relevant lines from your usercustomize.py in your user site-packages.

Example

from transformers import Qwen3MoeForCausalLM

model = Qwen3MoeForCausalLM.from_pretrained("Qwen/Qwen3-MoE-15B-A2B")

Configuration

DenseMixer can be controlled with environment variables:

Variable Default Description
DENSEMIXER_ENABLED 1 Master switch to enable/disable DenseMixer
DENSEMIXER_QWEN3 1 Enable for Qwen3-MoE models
DENSEMIXER_QWEN2 1 Enable for Qwen2-MoE models
DENSEMIXER_OLMOE 1 Enable for OLMoE models

Examples

Disable DenseMixer completely:

export DENSEMIXER_ENABLED=0
python your_script.py

Only enable for Qwen3-MoE:

export DENSEMIXER_ENABLED=1
export DENSEMIXER_QWEN3=1
export DENSEMIXER_QWEN2=0
export DENSEMIXER_OLMOE=0
python your_script.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

densemixer-0.1.0.post2.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

densemixer-0.1.0.post2-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file densemixer-0.1.0.post2.tar.gz.

File metadata

  • Download URL: densemixer-0.1.0.post2.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for densemixer-0.1.0.post2.tar.gz
Algorithm Hash digest
SHA256 8e98a59cc5e46a53bb3421aa2cac64ba0d17ab73cf6ef291bd45c36fe08dfd1e
MD5 7b70f6c6134cfce38c42546960791959
BLAKE2b-256 32e99134b0621517d37430c8d3e9dda078d71f460049bcbc0db6b95919520f60

See more details on using hashes here.

File details

Details for the file densemixer-0.1.0.post2-py3-none-any.whl.

File metadata

File hashes

Hashes for densemixer-0.1.0.post2-py3-none-any.whl
Algorithm Hash digest
SHA256 be70555582d4bb1392d4708620987dc1608bbc68785028b22394de497f2bd25f
MD5 1a91736ee297ba4209f331b2240449e7
BLAKE2b-256 e3ec65d6975eebdb9ee7c03c964ce0e5ad7fb3e31992da9eaccd920fb5327ae0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page