Learn R Programming

vmsae (version 0.1.2)

load_environment: Load Python Environment and Source Model Modules

Description

This function activates a specified Python virtual environment and sources Python modules used by the vmsae package, including models and python scripts.

Usage

load_environment(envname = "vmsae", is_conda = FALSE)

Value

No return value, called for side effects

Arguments

envname

Character. The name of the Python environment to create or update. Default is "vmsae".

is_conda

Boolean. The indicator for whether the loaded environment is a conda environment. Default is "FALSE".

Details

The function loads four Python scripts located in the package's py/ directory:

  • vgmcar.py

  • vae.py

  • train_vae.py

  • car_dataset.py

The environment must be created beforehand (e.g., using install_environment()), and must include all Python dependencies required by these modules.

Examples

Run this code
if (FALSE) {
library(vmsae)

# this function is time consuming for the first run
install_environment()
load_environment()          # Load default "vmsae" environment

# this function is time consuming for the first run
install_environment("custom")
load_environment("custom") # Load custom virtual environment

load_environment("custom", is_conda = TRUE) # Load custom conda environment
}

Run the code above in your browser using DataLab