pub struct PromptTuning { /* private fields */ }Expand description
Prompt Tuning implementation
Implementations§
Source§impl PromptTuning
impl PromptTuning
Sourcepub fn new(config: PromptTuningConfig) -> Result<Self, String>
pub fn new(config: PromptTuningConfig) -> Result<Self, String>
Create new prompt tuning
Sourcepub fn get_prompt_embeddings(&self) -> Result<Tensor, String>
pub fn get_prompt_embeddings(&self) -> Result<Tensor, String>
Get prompt embeddings
Sourcepub fn prepend_prompts(
&self,
input_embeddings: &Tensor,
) -> Result<Tensor, String>
pub fn prepend_prompts( &self, input_embeddings: &Tensor, ) -> Result<Tensor, String>
Prepend prompts to input embeddings
Sourcepub fn num_parameters(&self) -> usize
pub fn num_parameters(&self) -> usize
Get number of trainable parameters
Sourcepub fn parameter_efficiency(&self, total_model_params: usize) -> f32
pub fn parameter_efficiency(&self, total_model_params: usize) -> f32
Get parameter efficiency ratio
Auto Trait Implementations§
impl Freeze for PromptTuning
impl !RefUnwindSafe for PromptTuning
impl Send for PromptTuning
impl Sync for PromptTuning
impl Unpin for PromptTuning
impl !UnwindSafe for PromptTuning
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> 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