pub struct Loader<Hp: Hyperparameters, F: FnMut(LoadProgress)> {
pub container_type: ContainerType,
pub hyperparameters: Hp,
pub vocabulary: Vocabulary,
pub tensors: HashMap<String, TensorLoadInfo>,
/* private fields */
}
Expand description
A GGML format loader for LLMs.
Fields§
§container_type: ContainerType
The container type of the model.
hyperparameters: Hp
The hyperparameters of the model.
vocabulary: Vocabulary
The vocabulary of the model.
tensors: HashMap<String, TensorLoadInfo>
The tensors of the model.
Implementations§
Source§impl<Hp: Hyperparameters, F: FnMut(LoadProgress)> Loader<Hp, F>
impl<Hp: Hyperparameters, F: FnMut(LoadProgress)> Loader<Hp, F>
Trait Implementations§
Source§impl<Hp: Hyperparameters, F: FnMut(LoadProgress)> LoadHandler<LoadError> for Loader<Hp, F>
impl<Hp: Hyperparameters, F: FnMut(LoadProgress)> LoadHandler<LoadError> for Loader<Hp, F>
Source§fn container_type(
&mut self,
container_type: ContainerType,
) -> Result<(), LoadError>
fn container_type( &mut self, container_type: ContainerType, ) -> Result<(), LoadError>
Called when the ContainerType is read.
Source§fn vocabulary_token(
&mut self,
i: usize,
token: Vec<u8>,
score: f32,
) -> Result<(), LoadError>
fn vocabulary_token( &mut self, i: usize, token: Vec<u8>, score: f32, ) -> Result<(), LoadError>
Called when a token is read so it can be added to the model’s vocabulary.
Source§fn read_hyperparameters(
&mut self,
reader: &mut dyn BufRead,
) -> Result<PartialHyperparameters, LoadError>
fn read_hyperparameters( &mut self, reader: &mut dyn BufRead, ) -> Result<PartialHyperparameters, LoadError>
Called when the model’s hyperparameters need to be read.
Source§fn tensor_buffer(&mut self, info: TensorLoadInfo) -> Result<(), LoadError>
fn tensor_buffer(&mut self, info: TensorLoadInfo) -> Result<(), LoadError>
Called when a new crate::Tensor is read for the model.
Auto Trait Implementations§
impl<Hp, F> Freeze for Loader<Hp, F>
impl<Hp, F> RefUnwindSafe for Loader<Hp, F>where
F: RefUnwindSafe,
Hp: RefUnwindSafe,
impl<Hp, F> Send for Loader<Hp, F>
impl<Hp, F> Sync for Loader<Hp, F>
impl<Hp, F> Unpin for Loader<Hp, F>
impl<Hp, F> UnwindSafe for Loader<Hp, F>where
F: UnwindSafe,
Hp: UnwindSafe,
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