pub struct RnnModel { /* private fields */ }
Expand description
An RnnModel
contains all the model parameters for the denoising algorithm.
nnnoiseless
has a built-in model that should work for most purposes, but if you have
specific needs then you might benefit from training a custom model. Scripts for model
training are available as part of RNNoise
; once the model is trained, you can load it
here.
Implementations§
Source§impl RnnModel
impl RnnModel
Sourcepub fn from_bytes(bytes: &[u8]) -> Option<RnnModel>
pub fn from_bytes(bytes: &[u8]) -> Option<RnnModel>
Reads an RnnModel
from an array of bytes, in the format produced by the
nnnoiseless
training scripts.
Sourcepub fn from_static_bytes(bytes: &'static [u8]) -> Option<RnnModel>
pub fn from_static_bytes(bytes: &'static [u8]) -> Option<RnnModel>
Reads an RnnModel
from a static array of bytes, in the format produced by the
nnnoiseless
training scripts.
This differs from RnnModel::from_bytes
in that the returned model doesn’t need to
allocate its own byte buffers; it will just store references to the provided bytes
array.
For example, if you have your neural network weights available at compile-time then the following code will embed them into your binary and initialize a model without allocation:
let weight_data: &'static [u8] = include_bytes!("/path/to/model/weights.rnn");
let model = RnnModel::from_static_bytes(weight_data).expect("Corrupted model file");