Skip to content

Fix Legacy Model Loading (Additional Linear Layer) - #78

Open
kbcoulter wants to merge 2 commits into
ohsu-comp-bio:developfrom
kbcoulter:fix-layer-import
Open

kbcoulter wants to merge 2 commits into
ohsu-comp-bio:developfrom
kbcoulter:fix-layer-import

Conversation

@kbcoulter

Copy link
Copy Markdown
Contributor

Fixing legacy loading for models with the final encoder layer.

Embedding Rotation RPPA 512 model fails to load. LayerList.build() has a guard that skips adding the final linear layer when the last hidden layer's width is equivalent to the output dim. Models built before this update will have this final layer, but attempt to load the encoder without it, returning unexpected weights and failing

Changing the LayerList.build() would fix loading, but would effectively revert to the legacy model.

Fix:

factory.load() now loads non-strict. If the mismatch is a missing encoder.net.<N>.weight/.bias pair, that linearlayer is added to the encoder and reloaded strict. Anything that isnt this pattern (legacy model linear layer difference) should still raise a runtime error.

Again, I did not include tests for this. If this should include tests to ensure that we correctly load a legacy model, but fail on a dummy model, I can add that.

…expected when loading legacy models and patches if necessary. Changed some loading around this function to ensure that loading still fails, as expected, with non-legacy models.

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.

1 participant