From 7d66f089b56c5556fd85a39ddaa96a5d72edaa89 Mon Sep 17 00:00:00 2001 From: TroyHernandez Date: Wed, 18 Mar 2026 10:13:08 -0500 Subject: [PATCH 1/2] Warn when torch backend is not installed Add .onAttach message when Lantern is missing and document torch::install_torch() in README install instructions. --- R/zzz.R | 9 +++++++++ README.md | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/R/zzz.R b/R/zzz.R index 0f43fac..35d8b98 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -2,3 +2,12 @@ #' @importFrom stats setNames NULL +.onAttach <- function(libname, pkgname) { + if (!torch::torch_is_installed()) { + packageStartupMessage( + "torch backend (Lantern) is not installed.\n", + "Run torch::install_torch() to complete setup." + ) + } +} + diff --git a/README.md b/README.md index 43c15db..8464a71 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,18 @@ Native R torch implementation of OpenAI Whisper for speech-to-text transcription ```r install.packages("whisper") +torch::install_torch() # one-time: downloads the C++ backend ``` Or install the development version from GitHub: ```r remotes::install_github("cornball-ai/whisper") +torch::install_torch() ``` +`{whisper}` uses `{torch}` for inference. After installing the R package, `install_torch()` downloads the compiled C++ libraries (Lantern). You only need to run it once. + ## Quick Start ```r From caf2fbf9c9e83977c0f82658124eee96a696ed3c Mon Sep 17 00:00:00 2001 From: TroyHernandez Date: Wed, 18 Mar 2026 10:46:44 -0500 Subject: [PATCH 2/2] Fix install_torch docs: sudo for system library --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 8464a71..d549af6 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,12 @@ torch::install_torch() `{whisper}` uses `{torch}` for inference. After installing the R package, `install_torch()` downloads the compiled C++ libraries (Lantern). You only need to run it once. +**littler/r2u users:** If `install_torch()` fails with a permissions error, torch was installed to the system library. Use sudo for the one-time Lantern download: + +```bash +sudo r -e 'torch::install_torch()' +``` + ## Quick Start ```r