pub struct DiscriminativeFineTuning {
pub base_lr: f64,
pub decay_factor: f64,
/* private fields */
}Expand description
Discriminative fine-tuning: use different learning rates for different layers.
Typically, earlier layers use smaller learning rates than later layers.
Fields§
§base_lr: f64Base learning rate for the last layer.
decay_factor: f64Learning rate decay factor (each earlier layer uses lr * decay_factor).
Implementations§
Source§impl DiscriminativeFineTuning
impl DiscriminativeFineTuning
Sourcepub fn new(base_lr: f64, decay_factor: f64) -> TrainResult<Self>
pub fn new(base_lr: f64, decay_factor: f64) -> TrainResult<Self>
Create a new discriminative fine-tuning configuration.
§Arguments
base_lr- Learning rate for the last layerdecay_factor- Decay factor for earlier layers (e.g., 0.5 means half LR)
Sourcepub fn compute_layer_lrs(&mut self, layer_order: &[String])
pub fn compute_layer_lrs(&mut self, layer_order: &[String])
Compute learning rates for all layers.
§Arguments
layer_order- Layer names ordered from bottom to top
Sourcepub fn get_layer_lr(&self, layer_name: &str) -> f64
pub fn get_layer_lr(&self, layer_name: &str) -> f64
Trait Implementations§
Source§impl Clone for DiscriminativeFineTuning
impl Clone for DiscriminativeFineTuning
Source§fn clone(&self) -> DiscriminativeFineTuning
fn clone(&self) -> DiscriminativeFineTuning
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DiscriminativeFineTuning
impl RefUnwindSafe for DiscriminativeFineTuning
impl Send for DiscriminativeFineTuning
impl Sync for DiscriminativeFineTuning
impl Unpin for DiscriminativeFineTuning
impl UnwindSafe for DiscriminativeFineTuning
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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