Skip to content

Refactor ecosystem support into integrations - #512

Merged
justinchuby merged 3 commits into
mainfrom
copilot/integrations-refactor
Aug 18, 2026
Merged

justinchuby merged 3 commits into
mainfrom
copilot/integrations-refactor

Conversation

@justinchuby

@justinchuby justinchuby commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • move Transformers discovery and build orchestration under mobius.integrations.transformers
  • move Diffusers pipeline discovery and component builds under mobius.integrations.diffusers
  • keep ecosystem-agnostic ONNX graph construction in canonical core module mobius._builder
  • centralize shared Hugging Face weight loading under mobius.integrations._weight_loading
  • remove the old private compatibility modules and migrate all source, tests, docs, examples, and patch targets to canonical paths

Validation

  • lintrunner f --output oneline --all-files
  • full non-integration suite: 3993 passed, 52 skipped
  • 3 failures reproduced unchanged on main: Gemma4/Gemma3n audio shape inference and unavailable cached Gemma4 assistant config
  • public API identity/signature and removed-module smoke checks passed

Move Transformers discovery/config loading and Diffusers pipeline support under dedicated integration packages. Centralize shared Hugging Face weight loading, preserve legacy private module aliases and public signatures, and add compatibility coverage for imports and monkeypatch injection points.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 39ff6824-d35f-4d3b-8f5f-043a7119a100
Signed-off-by: GitHub Copilot <[email protected]>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

github-actions Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Performance Comparison

Comparing 189a19c → b70947b

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 60 60 +0.0% ⚪
falcon model_size_bytes 364 KB 364 KB +0.0% ⚪
falcon num_nodes 66 66 +0.0% ⚪
gemma2 model_size_bytes 428 KB 428 KB +0.0% ⚪
gemma2 num_nodes 105 105 +0.0% ⚪
gpt2 model_size_bytes 388 KB 388 KB +0.0% ⚪
gpt2 num_nodes 54 54 +0.0% ⚪
llama model_size_bytes 425 KB 425 KB +0.0% ⚪
llama num_nodes 60 60 +0.0% ⚪
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
llama (static-cache) num_nodes 56 56 +0.0% ⚪
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0% ⚪
mamba (ssm-text-generation) num_nodes 94 94 +0.0% ⚪
phi3 model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 num_nodes 58 58 +0.0% ⚪
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 (static-cache) num_nodes 54 54 +0.0% ⚪
qwen2 model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 num_nodes 60 60 +0.0% ⚪
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 (static-cache) num_nodes 56 56 +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) num_nodes 264 264 +0.0% ⚪
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0% ⚪
qwen3_5_text (hybrid-text-generation) num_nodes 126 126 +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) num_nodes 428 428 +0.0% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 166 166 +0.0% ⚪
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0% ⚪
whisper (speech-to-text) num_nodes 128 128 +0.0% ⚪

No performance regressions.

@github-actions

github-actions Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 189a19c → b70947b

Model Sub-model Changes Status
bert (feature-extraction) model 0 ⚪
falcon model 0 ⚪
gemma2 model 0 ⚪
gemma4 (gemma4) decoder 0 ⚪
gemma4 (gemma4) embedding 0 ⚪
gemma4 (gemma4) vision_encoder 0 ⚪
gemma4_text model 0 ⚪
gpt2 model 0 ⚪
llama model 0 ⚪
llama (static-cache) model 0 ⚪
mamba (ssm-text-generation) model 0 ⚪
phi3 model 0 ⚪
phi3 (static-cache) model 0 ⚪
qwen model 0 ⚪
qwen (static-cache) model 0 ⚪
qwen2 model 0 ⚪
qwen2 (static-cache) model 0 ⚪
qwen2_moe model 0 ⚪
qwen2_moe (static-cache) model 0 ⚪
qwen3 model 0 ⚪
qwen3 (static-cache) model 0 ⚪
qwen3_5_moe (hybrid-text-generation) model 0 ⚪
qwen3_5_text (hybrid-text-generation) model 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) decoder 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) embedding 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) vision_encoder 0 ⚪
qwen3_moe model 0 ⚪
qwen3_moe (static-cache) model 0 ⚪
qwen3_next (hybrid-text-generation) model 0 ⚪
t5 (seq2seq) decoder 0 ⚪
t5 (seq2seq) encoder 0 ⚪
whisper (speech-to-text) decoder 0 ⚪
whisper (speech-to-text) encoder 0 ⚪

No architecture changes detected. ✅


Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors external ecosystem support into dedicated mobius.integrations subpackages, separating Hugging Face Transformers model resolution/building from Diffusers pipeline discovery/building, while keeping legacy private-module imports working via compatibility aliases.

Changes:

  • Added mobius.integrations.transformers config resolution + build orchestration, with Diffusers fallback for non-Transformers repos.
  • Added mobius.integrations.diffusers pipeline/config support and centralized shared weight downloading/application utilities.
  • Replaced legacy private modules (mobius._builder, _config_resolver, _diffusers_*, _weight_loading) with sys.modules aliases and added boundary/compatibility tests.

Reviewed changes

Copilot reviewed 41 out of 42 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/mobius/tasks/_video_denoising.py Update Diffusers config import path to the new integrations package.
src/mobius/tasks/_vae.py Update Diffusers config import path to the new integrations package.
src/mobius/tasks/_qwen_image.py Update Diffusers config import path to the new integrations package.
src/mobius/tasks/_qwen_image_vae.py Update Diffusers config import path to the new integrations package.
src/mobius/tasks/_minimax_music3.py Switch Diffusers constants import to integrations; minor import reordering.
src/mobius/tasks/_denoising.py Update Diffusers config import path to the new integrations package.
src/mobius/models/vae.py Switch VAEConfig import to mobius.integrations.diffusers._configs.
src/mobius/models/unet.py Switch UNet2DConfig import to mobius.integrations.diffusers._configs.
src/mobius/models/qwen_image.py Switch QwenImageConfig import to mobius.integrations.diffusers._configs.
src/mobius/models/qwen_image_vae.py Switch QwenImageVAEConfig import to mobius.integrations.diffusers._configs.
src/mobius/models/minimax_music3.py Switch MiniMax Music3 config imports to mobius.integrations.diffusers._configs.
src/mobius/models/cogvideox.py Switch CogVideoXConfig import to mobius.integrations.diffusers._configs.
src/mobius/integrations/transformers/_config_resolver.py New Transformers config resolution utilities (registry-backed, composite config handling).
src/mobius/integrations/transformers/_config_resolver_test.py Point config-resolver tests at the new integrations module.
src/mobius/integrations/transformers/_builder.py New Transformers-centric builder with Diffusers fallback and shared weight-loading path.
src/mobius/integrations/transformers/_builder_test.py New test covering legacy monkeypatch interception of weight downloading.
src/mobius/integrations/transformers/init.py New lazy-export package surface for Transformers integration.
src/mobius/integrations/ort_genai/auto_export.py Import build via legacy alias to preserve downstream monkeypatch behavior.
src/mobius/integrations/nemo/_builder.py Switch to integrations builder + Transformers task resolver.
src/mobius/integrations/moshi/_builder.py Switch to integrations builder utilities.
src/mobius/integrations/gguf/_mmproj.py Switch to integrations builder utilities.
src/mobius/integrations/gguf/_builder.py Switch to integrations builder utilities + task resolver import relocation.
src/mobius/integrations/diffusers/_configs.py New Diffusers configuration adapters/constants under integrations.
src/mobius/integrations/diffusers/_configs_test.py Update tests to target the new Diffusers configs module.
src/mobius/integrations/diffusers/_builder.py New Diffusers pipeline builder under integrations (component discovery, per-component exports).
src/mobius/integrations/diffusers/_builder_test.py Update tests to target the new Diffusers builder module.
src/mobius/integrations/diffusers/init.py New lazy-export package surface for Diffusers integration.
src/mobius/integrations/_weight_loading.py New shared weight download + apply implementation (safetensors-first, FP8 dequant).
src/mobius/integrations/_weight_loading_test.py Update security/path-scanning tests to the new weight-loading location.
src/mobius/integrations/_integration_test.py New integration-boundary tests for public API mapping + legacy module aliasing.
src/mobius/integrations/_builder.py New core build API under integrations (dtype, graph build, optional opset lowering, Transformers dispatch).
src/mobius/integrations/_builder_test.py New unit tests for opset lowering logic and revision threading to Diffusers fallback.
src/mobius/integrations/init.py New top-level integrations package API wrapper functions.
src/mobius/_weight_loading.py Replace legacy implementation with compatibility alias to integrations weight loader.
src/mobius/_testing/ort_inference.py Point opset-lowering helper import at integrations builder.
src/mobius/_model_package.py Point internal weight assignment helper import at integrations weight loader.
src/mobius/_diffusers_configs.py Replace legacy implementation with compatibility alias to integrations Diffusers configs.
src/mobius/_diffusers_builder.py Replace legacy implementation with compatibility alias to integrations Diffusers builder.
src/mobius/_config_resolver.py Replace legacy implementation with compatibility alias to integrations Transformers config resolver.
src/mobius/_builder.py Replace legacy implementation with compatibility alias to integrations builder.
src/mobius/main.py Update CLI wiring to new integrations modules and imports.
src/mobius/init.py Rewire public exports to the new integrations entrypoints and apply_weights location.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/mobius/integrations/_builder.py Resolved
Copilot AI added 2 commits August 18, 2026 01:56
Make mobius._builder the canonical ecosystem-agnostic graph builder and keep Transformers and Diffusers orchestration exclusively under integrations. Remove the old private module aliases, migrate all callers, tests, documentation, and patch targets, and retain only the supported top-level public API.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 39ff6824-d35f-4d3b-8f5f-043a7119a100
Signed-off-by: GitHub Copilot <[email protected]>
Avoid writing directly to stdout from the shared integration weight loader so applications can configure download status verbosity.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 39ff6824-d35f-4d3b-8f5f-043a7119a100
Signed-off-by: GitHub Copilot <[email protected]>
@justinchuby
justinchuby marked this pull request as ready for review August 18, 2026 02:13
@justinchuby
justinchuby requested a review from a team August 18, 2026 02:13
@justinchuby
justinchuby merged commit 5589243 into main Aug 18, 2026
21 of 23 checks passed
@justinchuby
justinchuby deleted the copilot/integrations-refactor branch August 18, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants