Refactor trap workflow API: add randomize_model and propagate permuted_ids#370
Open
charlesmartin14 wants to merge 7 commits intomasterfrom
Open
Refactor trap workflow API: add randomize_model and propagate permuted_ids#370charlesmartin14 wants to merge 7 commits intomasterfrom
randomize_model and propagate permuted_ids#370charlesmartin14 wants to merge 7 commits intomasterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
permuted_idsto guarantee consistent trap indexing and fingerprints across tools.Description
randomize_model(ww, model, ...)inweightwatcher/remove_traps.pywhich deep-copies and permutes eligible layer weights and returns(randomized_model, permuted_ids).WeightWatcher.randomize_model(...)method that forwards to the new helper for callers to obtain a randomized model and per-layer permutation ids.WeightWatcher.analyze_traps(...)signature to acceptrandomized_modelandpermuted_ids, and updatedtrap_analysis.analyze_traps(...)to accept and forwardpermuted_idsinto per-layer params.apply_analyze_trapsto use externally suppliedpermuted_idswhen present instead of generating new permutations so analysis and removal remain synchronized.weightwatcher/remove_traps.py,weightwatcher/weightwatcher.py, andweightwatcher/trap_analysis.py.Testing
pytest -q tests/test_analyze_traps.py::TestAnalyzeTraps::test_analyze_traps_trap_burden_columns_appear tests/test_remove_traps.py::test_remove_traps_public_api_direct_callwhich produced1 passed, 1 skipped.Codex Task