# Get optimized config for a 700MB model on a laptop
config <- edge_small_model_config(model_size_mb = 700, available_ram_gb = 8)
# Use the config to load a model
if (FALSE) {
model_path <- "path/to/tinyllama.gguf"
if (file.exists(model_path)) {
ctx <- edge_load_model(
model_path,
n_ctx = config$n_ctx,
n_gpu_layers = config$n_gpu_layers
)
result <- edge_completion(
ctx,
prompt = "Hello",
n_predict = config$recommended_n_predict,
temperature = config$recommended_temperature
)
edge_free_model(ctx)
}
}
Run the code above in your browser using DataLab