Learn R Programming

BERTopic (version 0.1.0)

bertopic_save: Save a BERTopic model

Description

Save a fitted BERTopic model to disk. Depending on the serialization method, this may produce either a single file (e.g., *.pkl / *.pt / *.safetensors) or a directory bundle. The function does not pre-create the target path; it only ensures the parent directory exists and lets BERTopic decide the layout.

Usage

bertopic_save(
  model,
  path,
  serialization = c("pickle", "safetensors", "pt"),
  save_embedding_model = FALSE,
  overwrite = FALSE
)

Value

Invisibly returns the normalized path.

Arguments

model

A "bertopic_r" model.

path

Destination path (file or directory, as required by BERTopic).

serialization

One of "pickle", "safetensors", or "pt". Default "pickle".

save_embedding_model

Logical; whether to include the embedding model. Default FALSE.

overwrite

Logical; if TRUE and the target exists, it will be replaced.