View source: R/setup_modules.R
| setup_modules | R Documentation |
Builds the Python environment for transforEmotion ahead of first use and downloads the default models, so the first analysis call does not wait on either. Calling it is optional: every function sets up what it needs on first use.
setup_modules(
extras = character(),
download_models = TRUE,
models = character()
)
extras |
Character vector of optional feature sets to install together with the core packages:
|
download_models |
Logical. Download the default text, image and
sentence-similarity models into the Hugging Face cache (about 1 GB), the
face recognition model |
models |
Character vector of additional Hugging Face model IDs to
download, such as |
Python requirements are declared with py_require.
reticulate resolves them with uv into a cached environment, so after the
first run later sessions start in under a second. No conda installation or
manual uv installation is needed; reticulate downloads uv when it is not
on the PATH.
PyTorch is installed as a CPU-only build unless an NVIDIA GPU is detected.
Set TE_FORCE_CPU=1 to always use the CPU build, or
TRANSFOREMOTION_USE_GPU=1 to always use the CUDA build. The choice is
made when the package is loaded, so set either variable in
.Renviron or before library(transforEmotion), in a new R
session.
Invisibly returns NULL.
Alexander P. Christensen <alexpaulchristensen@gmail.com>
## Not run:
# Core packages and default models
setup_modules()
# Also install the packages rag() needs
setup_modules(extras = "rag")
# Prepare an additional model for offline use
setup_modules(models = "facebook/bart-large-mnli")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.