Skip to contents

model_remove() deletes the cached directory of one pinned model at its pinned revision, freeing its disk space. Downloaded models stay in the user cache until removed; a removed model can be installed again at the same pinned revision with model_download(), giving identical files.

Other models and the rest of the cache are left in place, and a model that is not installed is not an error. It returns TRUE, invisibly, when the model's directory no longer exists.

Custom models from load_custom() are stored under the custom subdirectory of the cache and are not removed by this function.

Usage

model_remove(cache_dir = default_cache_dir(), model = "all-MiniLM-L6-v2")

Arguments

cache_dir

Cache root (default cache_dir()).

model

Name of a pinned model, as listed by models() (default "all-MiniLM-L6-v2").

Value

Invisibly, TRUE when the model's directory no longer exists.

Conditions

sbert_unknown_model when model names no pinned model.

See also

cache_size() for disk use; model_status() to check a model; model_download() to install it again.

Examples

cache <- file.path(tempdir(), "sbert-example-cache")
model_remove(cache)