pub struct Normalizer {
model: LlamaModel,
}Expand description
A loaded normalizer. Holds the weights; cheap to call repeatedly.
Fields§
§model: LlamaModelImplementations§
Source§impl Normalizer
impl Normalizer
Sourcepub fn load(path: &Path) -> Result<Self, NormalizeError>
pub fn load(path: &Path) -> Result<Self, NormalizeError>
Load weights from a GGUF file.
The architecture is checked against CAUSAL_ARCHS BEFORE the load -
see NormalizeError::NotCausal for why that order is the whole
point of the check.
Sourcepub fn normalize(&self, text: &str) -> Result<String, NormalizeError>
pub fn normalize(&self, text: &str) -> Result<String, NormalizeError>
Rewrite one raw transcript as written text, at the shipped defaults.
An empty result is a valid answer, not a failure: input that is nothing but filler normalizes to nothing.
Sourcepub fn normalize_with(
&self,
text: &str,
opts: NormalizeOptions,
) -> Result<String, NormalizeError>
pub fn normalize_with( &self, text: &str, opts: NormalizeOptions, ) -> Result<String, NormalizeError>
As Normalizer::normalize, with the register and decoder settings
chosen per call. Nothing here is cached against them, so they cost a
string format and can change on every call.
Sourcefn run(
&self,
prompt: &str,
source: &str,
opts: NormalizeOptions,
) -> Result<String, NormalizeError>
fn run( &self, prompt: &str, source: &str, opts: NormalizeOptions, ) -> Result<String, NormalizeError>
source is what speculation drafts from, and is the transcript
rather than the prompt wrapped around it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Normalizer
impl RefUnwindSafe for Normalizer
impl Send for Normalizer
impl Sync for Normalizer
impl Unpin for Normalizer
impl UnsafeUnpin for Normalizer
impl UnwindSafe for Normalizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more