You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Search for duplicates among the existing issues, both open and closed.
Description
A Keras model can only be saved using the same R session that fit the model. So if you have a plan with target(keras_model, format = "keras") and you make() it with HPC, you must set caching = "worker". Worker caching is almost always slower than master caching, especially for a large number of targets, so maybe it would be nice to set different caching methods for different targets. As with other custom columns such as "trigger", a "caching" column would override the corresponding argument to make().
library(drake)
drake_plan(
x= target(fit_model(1), caching="master"),
y= target(fit_model(1), caching="worker")
)
#> # A tibble: 2 x 3#> target command caching#> <chr> <expr> <chr> #> 1 x fit_model(1) master #> 2 y fit_model(1) worker
Worker caching is almost always slower, so it might be nice to find workarounds instead of developing it seriously as a feature.
For Keras models specifically, the workaround is easy: instead of using target(format = "keras"), simply call serialize_model() before you return the fitted model. Then, the model will still be valid even if you send it to a different R process.
The text was updated successfully, but these errors were encountered:
Prework
drake
's code of conduct.Description
A Keras model can only be saved using the same R session that fit the model. So if you have a plan with
target(keras_model, format = "keras")
and youmake()
it with HPC, you must setcaching = "worker"
. Worker caching is almost always slower than master caching, especially for a large number of targets, so maybe it would be nice to set different caching methods for different targets. As with other custom columns such as "trigger", a "caching" column would override the corresponding argument tomake()
.Created on 2019-08-18 by the reprex package (v0.3.0)
Hesitation
I am not sure about this feature because
target(format = "keras")
, simply callserialize_model()
before you return the fitted model. Then, the model will still be valid even if you send it to a different R process.The text was updated successfully, but these errors were encountered: