Skip to content
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

Merged
merged 5 commits into from
Dec 23, 2020
Merged

Wrappers for freeze() and unfreeze() #86

merged 5 commits into from
Dec 23, 2020

Conversation

Cdk29
Copy link
Contributor

@Cdk29 Cdk29 commented Dec 20, 2020

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

@turgut090
Copy link
Member

@Cdk29 Btw, you could add here a ggplot method for visualization instead of matplotlob. (additional argument to function, e.g. method="ggplot2") Because learn %>% lr_find() returns a dataframe.

https://github.com/henry090/fastai/blob/0cffb51bef19723a9e3533e40a5a770f3b5f2d9a/R/test.R#L281-L297

@Cdk29
Copy link
Contributor Author

Cdk29 commented Dec 22, 2020

@henry090 yes, and this would allow to pipe directly like this :

learn %>% lr_find() %>% plot_lr_find()

I will do this in an other PR ^^

R/freeze.R Outdated
#' }
unfreeze <- function(object){

args <- list()
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

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, ...){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Cdk29 you forgot to add @param to the documentation part. And please change @return Nothing to None.

Copy link
Contributor Author

@Cdk29 Cdk29 Dec 23, 2020

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.

@turgut090
Copy link
Member

Thanks very much!

@turgut090 turgut090 merged commit a79a219 into EagerAI:master Dec 23, 2020
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.

2 participants