-
Notifications
You must be signed in to change notification settings - Fork 13
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
Wrappers for freeze() and unfreeze() #86
Conversation
…unfreeze using the pipe operator
@Cdk29 Btw, you could add here a ggplot method for visualization instead of matplotlob. (additional argument to function, e.g. |
@henry090 yes, and this would allow to pipe directly like this :
I will do this in an other PR ^^ |
R/freeze.R
Outdated
#' } | ||
unfreeze <- function(object){ | ||
|
||
args <- list() |
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 see there could be some parameters in learn$freeze(...). Could you add 3 dots after the object
argument? Pass these dots to args, then, please. The same for freeze/unfreeze.
@Cdk29 could you make the necessary changes, so I merge this.
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.
@henry090 I can yes. But the original fastai code cannot have additional argument so I am not sure it is a good idea : https://github.com/fastai/fastai/blob/master/fastai/learner.py#L521
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.
@Cdk29 It will not throw an error. It just allows passing something in case of future modifications. So, this is safe.
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.
@henry090 done !
@@ -9,12 +9,12 @@ | |||
#' \dontrun{ | |||
#' learnR %>% freeze() | |||
#' } | |||
freeze <- function(object){ | |||
freeze <- function(object, ...){ |
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.
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.
@henry090 Indeed, sorry for that. I have done the requested changes.
Thanks very much! |
Wrappers for the freeze() and unfreeze() methods from fastai.
Creating function allow to pipe the model into them. Also, I took the freedom to add a message, to make the functions more ergonomics and prevent doubts from the user on the success of the operation.
The function has been tested here : https://github.com/Cdk29/Cassava/blob/main/dev_freeze_unfreeze_fastai.md