rstudio / bundle

Prepare objects for serialization with a consistent interface
https://rstudio.github.io/bundle/
Other
28 stars 4 forks source link

don't `bundle()` unprepped steps #56

Closed simonpcouch closed 1 year ago

simonpcouch commented 1 year ago

Closes #54!

simonpcouch commented 1 year ago

The errors in these Actions look like the ones #53 addresses. I was able to get a (slightly) more complete error message locally:

── Error (test_bundle_workflows.R:164:3): bundling + unbundling tidymodels workflows (lm + step_umap) ──
<callr_status_error/callr_error/rlib_error_3_0/rlib_error/error/condition>
Error: ! in callr subprocess.
Caused by error in `step_umap()`:
! Error in `prep()`:
! Can't rename variables in this context.
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 6 ]
juliasilge commented 1 year ago

With this PR, I no longer see the problem I observed before with workflows:

Sys.setenv(RETICULATE_PYTHON="/Users/juliasilge/miniforge3/envs/keras-connect/bin/python")

library(workflows)
library(parsnip)
library(recipes)
#> Loading required package: dplyr
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
#> 
#> Attaching package: 'recipes'
#> The following object is masked from 'package:stats':
#> 
#>     step
library(embed)

set.seed(1)
rec <-
  recipe(mpg ~ ., data = mtcars) |>
  step_umap(all_predictors(), outcome = vars(mpg), num_comp = 2)
mod <- workflow(rec, linear_reg()) |> fit(data = mtcars)

bundle::bundle(mod)
#> bundled workflow object.

Created on 2023-09-05 with reprex v2.0.2