Skip to content

fix: preserve custom algorithm order across reload - #749

Open
DevChiniwala wants to merge 1 commit into
PrunaAI:mainfrom
DevChiniwala:fix/persist-custom-algorithm-order
Open

DevChiniwala wants to merge 1 commit into
PrunaAI:mainfrom
DevChiniwala:fix/persist-custom-algorithm-order

Conversation

@DevChiniwala

Copy link
Copy Markdown

Summary

Preserve explicit algorithm ordering across SmashConfig save/load and reload-time resmashing.

Root cause

SmashConfig._algorithm_order was an in-memory-only preference. It was not serialized, and resmash() passed the original full order even after disabling algorithms that should not be reapplied. Duplicate names were also accepted by the set-based validation.

Fix

  • Serialize and restore algorithm_order.
  • Clear stale custom ordering when loading legacy configs.
  • Filter custom ordering to algorithms reapplied during resmash().
  • Reject duplicate algorithm names.
  • Document the persistence behavior.

Validation

  • Added focused tests for save/load persistence, resmash filtering, and duplicate rejection.
  • pytest --basetemp check-tmp-pr-final tests/config/test_smash_config_serialization.py tests/engine/test_save.py::test_save_pruna_model_path_types -q — 5 passed.
  • Legacy config without algorithm_order was loaded successfully and cleared stale ordering.
  • ruff check src/pruna/config/smash_config.py src/pruna/engine/load.py tests/config/test_smash_config_serialization.py — passed.
  • ty check src/pruna/config/smash_config.py src/pruna/engine/load.py — passed.

GPU validation was not required; this change protects configuration and reload state.

AI assistance disclosure

This contribution was developed with AI assistance. The implementation, tests, and validation were reviewed against the repository code and executed locally.

Copilot AI lite review requested due to automatic review settings September 16, 2026 19:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
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.

2 participants