Hi All,
I am having some issues with deploying a test model to Connect using vetiver. Code im using is as per examples provided;
#part 1 - CREATE SIMPLE MODEL
library(parsnip)
library(workflows)
library(tidyverse)
library(tidymodels)
library(vetiver)
data(Sacramento, package = "modeldata")
sac<-Sacramento
#split data in to train, test and validation
set.seed(1353)
sac_split <- initial_split(sac, strata = price)
sac_train <- training(sac_split)
sac_test <- testing(sac_split)
## for model to training set
rf_spec <- rand_forest(mode = "regression")
rf_form <- price ~ type + sqft + beds + baths
rf_fit <-
workflow(rf_form, rf_spec) %>%
fit(sac_train)
#Now that our model is trained, we can estimate the model performance we expect to see on new data using our testing data.
rf_metric_set <- metric_set(rmse, rsq, ccc, mae)
rf_metrics <-
augment(rf_fit, new_data = sac_test) %>%
rf_metric_set(truth = price, estimate = .pred)
#create vetver version of model with metrics as metadata
v_rf <- vetiver_model(rf_fit, model_name = "house_price_model_rf", metadata = list(metrics = rf_metrics))
model_board <- board_connect(auth = "envvar", server = Sys.getenv("CONNECT_SERVER") ,versioned = TRUE)
model_board %>% vetiver_pin_write(v_rf)
First issue is that i cant use the vetiver_deploy_rsconnect() deployment method as the following results in error "Error: Multiple accounts with the name 'USERNAME' exist. Please specify the server of the account you wish to use. ";
vetiver::vetiver_deploy_rsconnect(model_board,"USERNAME/house_price_model_rf", account = "USERNAME",predict_args = list(debug = TRUE))
I have got around by using the vetiver_write_plumber() call;
vetiver_write_plumber(model_board, "USERNAME/house_price_model_rf", file = "plumber.R")
But for this model connect gives me the following error;
###ERROR LOG
2023/08/11 12:43:40 PM:
2023/08/11 12:43:41 PM: Error in map_chr(bad, "package") : ℹ In index: 1.
2023/08/11 12:43:41 PM: Caused by error:
2023/08/11 12:43:41 PM: Plumber API exiting ...
2023/08/11 12:43:41 PM: ! Result must be length 1, not 0.
2023/08/11 12:43:41 PM: Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
2023/08/11 12:43:41 PM: Execution halted
Anyone got anu points on either issue please?
Thanks