Skip to content

Commit

Permalink
disable the gradient history recording & set model in evaluation (inf…
Browse files Browse the repository at this point in the history
…erence) mode
  • Loading branch information
jwijffels committed Mar 18, 2024
1 parent 057f779 commit 859c261
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: audio.vadsilero
Type: Package
Title: Voice Activity Detection using 'Silero'
Version: 0.1
Version: 0.2
Maintainer: Jan Wijffels <[email protected]>
Authors@R: c(
person('Jan', 'Wijffels', role = c('aut', 'cre', 'cph'), email = '[email protected]', comment = "R wrapper"),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## CHANGES IN audio.vadsilero VERSION 0.2

- disable the gradient history recording & set model in evaluation (inference) mode

## CHANGES IN audio.vadsilero VERSION 0.1

- Added function Silero to detect voice in audio
Expand Down
2 changes: 1 addition & 1 deletion R/pkg.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#' @importFrom wav read_wav
#' @importFrom torch torch_tensor jit_load jit_scalar
#' @importFrom torch torch_tensor jit_load jit_scalar autograd_set_grad_mode
NULL
4 changes: 3 additions & 1 deletion R/silero.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ silero <- function(file,
}

SILERO <- function(){
mod <- torch::jit_load(system.file(package = "audio.vadsilero", "models", "silero_vad.jit"))
autograd_set_grad_mode(FALSE)
mod <- jit_load(system.file(package = "audio.vadsilero", "models", "silero_vad.jit"))
mod$eval()
out <- list(model = mod, version = "v4")
class(out) <- "SILERO"
out
Expand Down

0 comments on commit 859c261

Please sign in to comment.