Repository navigation
fix(checkpoint): match device_map keys by dotted path - #46
Draft
lslusarczyk wants to merge 2 commits into
Draft
lslusarczyk wants to merge 2 commits into
lslusarczyk wants to merge 2 commits into
Conversation
… state_dict `load` handed each child a filtered copy of the state_dict. The entry of a nested tuned module was removed from that copy only. It stayed in the state_dict that `load_state_dict(strict=False)` receives, which ignored it. The `if state_dict` skip for a fully tuned module never applied below the top level. Children now share the same state_dict, which also drops one copy per module. Signed-off-by: Łukasz Ślusarczyk <lukasz.slusarczyk@intel.com>
`load` looked up a nested tuned module in `device_map` by its attribute name. Two tuned modules named `linear1` in different submodules shared one entry. The key is now the dotted path, e.g. `inner.linear1`. A direct submodule keeps its key, so `linear1` still matches `model.linear1`. Signed-off-by: Łukasz Ślusarczyk <lukasz.slusarczyk@intel.com>
This branch has not been deployed
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.
loadnow matchesdevice_mapkeys of nested tuned modules by dotted path.loadlooked up a nested tuned module by its attribute name alone.For
model.inner.linear1the key waslinear1.Two tuned modules named
linear1in different submodules shared one entry.The key is now the dotted path, e.g.
inner.linear1.A direct submodule keeps its key, so
linear1still matchesmodel.linear1.Only modules nested two or more levels deep change their key.
The new tests tune a model nested two levels deep on XPU.
They fail without the fix.
Depends on #44, which changes the same recursion.
The first commit belongs to #44.