pub struct LlamaModelWrapper {
pub model_dir: Option<PathBuf>,
/* private fields */
}Fields§
§model_dir: Option<PathBuf>Implementations§
Source§impl LlamaModelWrapper
impl LlamaModelWrapper
pub fn from_varbuilder( vb: VarBuilder<'_>, config: &ModelDefinition, device: CandleDevice, dtype: DType, ) -> Result<Self>
pub fn forward_prefill( &self, input_ids: &Tensor, cache_key: &str, ) -> Result<Tensor>
pub fn forward_decode( &self, token_id: &Tensor, pos: usize, cache_key: &str, ) -> Result<Tensor>
pub fn export_kv_cache( &self, cache_key: &str, ) -> Option<Vec<(Tensor, Tensor, usize, usize)>>
pub fn release_cache(&self, cache_key: &str)
pub fn config(&self) -> &Config
pub fn device(&self) -> &CandleDevice
pub fn candle_device(&self) -> &CandleDevice
pub fn dtype(&self) -> DType
pub fn set_model_dir(&mut self, dir: PathBuf)
Auto Trait Implementations§
impl !Freeze for LlamaModelWrapper
impl !RefUnwindSafe for LlamaModelWrapper
impl Send for LlamaModelWrapper
impl Sync for LlamaModelWrapper
impl Unpin for LlamaModelWrapper
impl UnsafeUnpin for LlamaModelWrapper
impl !UnwindSafe for LlamaModelWrapper
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more