Skip to content

refactor(training): clean up finetune/freeze code readability - #314

Open
KakaruHayate wants to merge 2 commits into
openvpi:mainfrom
KakaruHayate:finetune-cleanup
Open

refactor(training): clean up finetune/freeze code readability#314
KakaruHayate wants to merge 2 commits into
openvpi:mainfrom
KakaruHayate:finetune-cleanup

Conversation

@KakaruHayate

@KakaruHayate KakaruHayate commented Jul 30, 2026

Copy link
Copy Markdown

Summary

Cleanup of the finetune and parameter-freezing loading paths in BaseTask, preserving the intended training behavior and all existing configuration keys while tightening error handling and checkpoint deserialization.

Changes

  • reorganize into load_finetune_checkpoint + load_finetune_weights with clear responsibilities
  • use clear internal names (checkpoint_path, ignored_prefixes, mismatched_shapes)
  • replace per-key print() with summarized rank_zero_info logs
  • avoid mutating the caller-provided state dict
  • simplify freeze_params with direct named_parameters() iteration
  • remove dead code and stale comments
  • reject missing/empty checkpoint paths with actionable errors
  • load with weights_only=True and map_location="cpu"

Verification

  • six behavior checks for shape handling, ignored prefixes, freezing, and local-checkpoint precedence
  • two review regression checks for empty-path rejection and restricted CPU checkpoint loading
  • compileall and git diff --check passed

- reorganize into load_finetune_checkpoint + load_finetune_weights
- use clear variable names (checkpoint_path, ignored_prefixes, mismatched_shapes)
- replace per-key print loop with summarized rank_zero_info
- avoid mutating input state dict in-place
- simplify freeze_params with direct named_parameters iteration
- delete dead code and dead comments from 2023-era
- add actionable ValueError for missing/invalid checkpoint path
- add weights_only=True for secure checkpoint loading
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