pub trait Adapter: Send + Sync {
type Config: AdapterConfig;
// Required methods
fn forward(
&self,
input: &Tensor,
base_output: Option<&Tensor>,
) -> Result<Tensor, PeftError>;
fn num_parameters(&self) -> usize;
fn config(&self) -> &Self::Config;
}Expand description
Core adapter trait for parameter-efficient fine-tuning.
Required Associated Types§
Sourcetype Config: AdapterConfig
type Config: AdapterConfig
The configuration type for this adapter.
Required Methods§
Sourcefn forward(
&self,
input: &Tensor,
base_output: Option<&Tensor>,
) -> Result<Tensor, PeftError>
fn forward( &self, input: &Tensor, base_output: Option<&Tensor>, ) -> Result<Tensor, PeftError>
Sourcefn num_parameters(&self) -> usize
fn num_parameters(&self) -> usize
Get the number of trainable parameters.