Skip to content

refactor: move mlx_dit and mlx_vae into models/mlx#602

Merged
ChuxiJ merged 1 commit intomainfrom
refactor/move-mlx-to-models
Feb 16, 2026
Merged

refactor: move mlx_dit and mlx_vae into models/mlx#602
ChuxiJ merged 1 commit intomainfrom
refactor/move-mlx-to-models

Conversation

@ChuxiJ
Copy link
Contributor

@ChuxiJ ChuxiJ commented Feb 16, 2026

  • Relocate acestep/mlx_dit/ -> acestep/models/mlx/dit_*.py
  • Relocate acestep/mlx_vae/ -> acestep/models/mlx/vae_*.py
  • Consolidate duplicate mlx_available() into models/mlx/init.py
  • Update all import paths in handler.py, diffusion.py, generation.py
  • Delete old mlx_dit/ and mlx_vae/ directories
  • No logic changes; pure move-and-rename refactor

Summary by CodeRabbit

  • Refactor
    • Internal reorganization of model components to improve code structure and maintainability. No changes to user-facing functionality or behavior.

- Relocate acestep/mlx_dit/ -> acestep/models/mlx/dit_*.py
- Relocate acestep/mlx_vae/ -> acestep/models/mlx/vae_*.py
- Consolidate duplicate mlx_available() into models/mlx/__init__.py
- Update all import paths in handler.py, diffusion.py, generation.py
- Delete old mlx_dit/ and mlx_vae/ directories
- No logic changes; pure move-and-rename refactor
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

📝 Walkthrough

Walkthrough

This PR reorganizes MLX (Machine Learning X) component import paths from scattered locations to a centralized acestep.models.mlx namespace. Functions, logic, and public APIs remain unchanged; only import statements, module structure, and documentation are updated.

Changes

Cohort / File(s) Summary
MLX import path relocations
acestep/core/generation/handler/diffusion.py, acestep/handler.py, acestep/models/mlx/dit_generate.py, acestep/ui/gradio/interfaces/generation.py
Import statements updated to reference MLX components from new acestep.models.mlx.* centralized locations instead of scattered acestep.mlx_dit and acestep.mlx_vae paths.
Removed MLX availability shim
acestep/mlx_vae/__init__.py
Removed runtime MLX availability check functions (is_mlx_available(), mlx_available()), related logging/platform imports, and cached availability variable. Total 33 lines removed.
Module documentation update
acestep/models/mlx/__init__.py
Updated module docstring from singular to plural form: "Native MLX implementation..." to "Native MLX implementations..."

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 With paws on keyboard, we reorganize,
Imports now gather where models reside,
MLX components in harmony dwell,
A cleaner namespace—all structured so well! 🎯

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main refactoring objective: moving MLX-related modules into a consolidated models/mlx directory structure.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/move-mlx-to-models

Comment @coderabbitai help to get the list of available commands and usage tips.

@ChuxiJ ChuxiJ merged commit 88c9f20 into main Feb 16, 2026
2 of 3 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
acestep/models/mlx/dit_generate.py (1)

1-4: ⚠️ Potential issue | 🟡 Minor

Add a module docstring (required for modified modules).

The header is comment-only; please add a concise module docstring that states purpose and key inputs/outputs.

✅ Suggested docstring
-# MLX diffusion generation loop for AceStep DiT decoder.
-#
-# Replicates the timestep scheduling and ODE/SDE stepping from
-# ``AceStepConditionGenerationModel.generate_audio`` using pure MLX arrays.
+"""MLX diffusion generation loop for the AceStep DiT decoder.
+
+Inputs: MLX decoder + numpy conditioning arrays.
+Outputs: numpy target latents and timing metrics.
+"""

As per coding guidelines, "Docstrings are mandatory for all new or modified Python modules, classes, and functions" and "Docstrings must be concise and include purpose plus key inputs/outputs (and raised exceptions when relevant)."

🤖 Fix all issues with AI agents
In `@acestep/models/mlx/__init__.py`:
- Around line 1-2: Replace the two-line header comment in __init__.py with a
proper module-level docstring that concisely states the module’s purpose (native
MLX implementations of AceStep models targeting Apple Silicon), describes
behavior (provides pure MLX inference with graceful fallback to PyTorch), and
enumerates the key exports/entry points provided by this package (list exported
classes, functions, and constants you expose from this __init__ such as MLX
model wrappers or factory functions) including expected inputs/outputs and any
raised exceptions; ensure the docstring follows project style (brief
description, usage/exports summary).

Comment on lines +1 to 2
# Native MLX implementations of AceStep models for Apple Silicon.
# Provides pure MLX inference with graceful fallback to PyTorch.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Replace the header comment with a module docstring.

This module is modified; it needs a docstring describing purpose and key exports.

✅ Suggested docstring
-# Native MLX implementations of AceStep models for Apple Silicon.
-# Provides pure MLX inference with graceful fallback to PyTorch.
+"""Native MLX implementations of AceStep models for Apple Silicon.
+
+Exports:
+  - is_mlx_available() -> bool
+  - mlx_available() -> bool
+"""

As per coding guidelines, "Docstrings are mandatory for all new or modified Python modules, classes, and functions" and "Docstrings must be concise and include purpose plus key inputs/outputs (and raised exceptions when relevant)."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Native MLX implementations of AceStep models for Apple Silicon.
# Provides pure MLX inference with graceful fallback to PyTorch.
"""Native MLX implementations of AceStep models for Apple Silicon.
Exports:
- is_mlx_available() -> bool
- mlx_available() -> bool
"""
🤖 Prompt for AI Agents
In `@acestep/models/mlx/__init__.py` around lines 1 - 2, Replace the two-line
header comment in __init__.py with a proper module-level docstring that
concisely states the module’s purpose (native MLX implementations of AceStep
models targeting Apple Silicon), describes behavior (provides pure MLX inference
with graceful fallback to PyTorch), and enumerates the key exports/entry points
provided by this package (list exported classes, functions, and constants you
expose from this __init__ such as MLX model wrappers or factory functions)
including expected inputs/outputs and any raised exceptions; ensure the
docstring follows project style (brief description, usage/exports summary).

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.

1 participant