| cuda_ml_serialize | R Documentation |
cuda_ml_serialize() saves the explicit state of a fitted cuda.ml
model. cuda_ml_unserialize() restores that state as a fitted model.
cuda_ml_serialize(model, connection = NULL, ...)
cuda_ml_unserialize(
connection,
...,
device = NULL,
device_id = NULL,
layout = NULL,
precision = NULL,
default_chunk_size = NULL,
align_bytes = NULL
)
model |
The model object. |
connection |
For |
... |
Additional arguments passed to |
device, device_id, layout, precision, default_chunk_size, align_bytes |
Named
nvForest inference options. They are supported only for nvForest and
random-forest states. When |
cuda_ml_serialize() returns NULL when writing to a
file or connection and otherwise returns a raw vector.
cuda_ml_unserialize() returns the restored fitted model.
Explicit state is supported for:
OLS, ridge, lasso, elastic-net, and SGD linear models;
logistic and multinomial regression;
PCA;
binary and one-vs-rest SVC models and SVR models;
UMAP;
random forests and other nvForest-backed models.
KNN and TSVD fits are not currently supported. The pinned KNN API does not expose portable approximate-index state, and the current TSVD binding retains native transform parameters that cuda.ml does not reconstruct.
cuda.ml validates the model state and required backend before loading it.
Prepare the backend in the target process with cuda_ml_install() for
GPU operation or cuda_ml_install(device = "cpu") for CPU-only
nvForest inference.
Random-forest and nvForest states contain device-neutral Treelite model
bytes. They retain prediction precision, class labels, preprocessing, and
model semantics, but not the inference device, device identifier, tree
layout, chunk size, or memory alignment. Select those settings while
restoring; omitting device selects GPU inference.
bundle::bundle() stores the same explicit state. For an
nvForest-backed model, the bundle also stores its chosen deployment device
separately from the device-neutral state. A bundle is not required for
deployment; cuda_ml_serialize() returns the complete state artifact
directly.
serialize,
unserialize, and bundle
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.