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

import densemixer  # This automatically applies the optimizations
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

Or in Python (must be set before importing densemixer):

import os
os.environ["DENSEMIXER_ENABLED"] = "1"
os.environ["DENSEMIXER_QWEN3"] = "1"
os.environ["DENSEMIXER_QWEN2"] = "0"
os.environ["DENSEMIXER_OLMOE"] = "0"

import densemixer

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.post1.tar.gz (6.3 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.post1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: densemixer-0.1.0.post1.tar.gz
  • Upload date:
  • Size: 6.3 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.post1.tar.gz
Algorithm Hash digest
SHA256 76a6158837d829f9059cdce2726f15d3bc8f2114c51dedcc879c9c63ab30626a
MD5 aa8db35dc58e60054a2d44f3fad54527
BLAKE2b-256 aa7730fe6f5a8c2b7dc65d2113f6d95fe9d3c378eb53740acfb067e06892fb2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for densemixer-0.1.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 77ab8d228c1dc4055709b07dbd51edac78eaf9488c7dd4d17eec943cfc3796c7
MD5 36d31843cf7f5839715c642cc072adc7
BLAKE2b-256 ca7c4cabae1e1a48bbf7d7bc52dd419498ebee89fd967ceb3bbc97f3afaed783

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