-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
457 geovex model saving loading #460
Merged
RaczeQ
merged 17 commits into
kraina-ai:main
from
sabman:457-geovex-model-saving-loading
Aug 26, 2024
Merged
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d3de483
WIP: save
sabman f51177a
wip load
sabman f5c3e41
load model
sabman 17fd214
update
sabman 393d25f
add get_config to GeoVexModel to match constructor allowing saving an…
sabman ad4f19b
create a location for test temp_model and clean up safely
sabman 284b994
fix(pre-commit.ci): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2960ec6
rm run_test.sh
sabman e400c76
Merge remote-tracking branch 'refs/remotes/origin/457-geovex-model-sa…
sabman 7d9465f
fix type errors
sabman f6614e5
ensure model has been fitted
sabman c1b5d47
fix docstring
sabman a62dcee
Delete run_tests.sh
sabman 7608eed
rm prints
sabman c6296e2
Merge remote-tracking branch 'refs/remotes/origin/457-geovex-model-sa…
sabman f0bd85f
remove prints
sabman af3b541
fix types; update changelog
sabman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -439,6 +439,8 @@ def __init__( | |||||||||||||||||||||||||||||
self.R = radius | ||||||||||||||||||||||||||||||
self.lr = learning_rate | ||||||||||||||||||||||||||||||
self.emb_size = emb_size | ||||||||||||||||||||||||||||||
self.conv_layer_size = conv_layer_size | ||||||||||||||||||||||||||||||
self.conv_layers = conv_layers | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
# input size is 2R + 2 | ||||||||||||||||||||||||||||||
self.M = get_shape(self.R) | ||||||||||||||||||||||||||||||
|
@@ -573,3 +575,20 @@ def configure_optimizers(self) -> list["torch.optim.Optimizer"]: | |||||||||||||||||||||||||||||
lr=self.lr, | ||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||
return [opt] | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
# override get_config to return the model configuration | ||||||||||||||||||||||||||||||
def get_config(self) -> dict[str, int | float]: | ||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||
Get the model configuration. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
Returns: | ||||||||||||||||||||||||||||||
Dict[str, int | float]: The model configuration. | ||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are still supporting the Python 3.9 version, so it doesn't accept the pipe syntax yet and tests on this Python version failed. Please change to the
Suggested change
|
||||||||||||||||||||||||||||||
return { | ||||||||||||||||||||||||||||||
"k_dim": self.k_dim, | ||||||||||||||||||||||||||||||
"radius": self.R, | ||||||||||||||||||||||||||||||
"conv_layers": self.conv_layers, | ||||||||||||||||||||||||||||||
"emb_size": self.emb_size, | ||||||||||||||||||||||||||||||
"learning_rate": self.lr, | ||||||||||||||||||||||||||||||
"conv_layer_size": self.conv_layer_size, | ||||||||||||||||||||||||||||||
} |
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there a check for a model not being
None
? Ifself._model
wasNone
, thesave
function would throw an exception.Should this be a check for a model config, or should the
save
function be moved inside this if statement?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see in the
Hex2Vec
implementation that there is no such check withif
statement.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RaczeQ thanks for the feedback. The type linter was complaining about
_model
beingNone
so we put in a check. But let us remove it and push again.