Skip to content

Commit

Permalink
Samplers accept default params.
Browse files Browse the repository at this point in the history
  • Loading branch information
cryscan committed Mar 8, 2024
1 parent e71f9ef commit 4454b22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/sampler/mirostat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct MirostatParams {
#[derivative(Default(value = "3.0"))]
pub tau: f32,
#[derivative(Default(value = "0.1"))]
#[serde(alias = "learning_rate")]
pub rate: f32,
#[derivative(Default(value = "128"))]
#[serde(default = "default_threshold")]
Expand Down
5 changes: 5 additions & 0 deletions src/sampler/nucleus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ pub struct NucleusParams {
#[derivative(Default(value = "0.0"))]
pub frequency_penalty: f32,
#[derivative(Default(value = "1.0"))]
#[serde(default = "default_penalty_decay")]
pub penalty_decay: f32,
}

fn default_penalty_decay() -> f32 {
NucleusParams::default().penalty_decay
}

#[derive(Debug, Default, Clone)]
pub struct NucleusState {
pub penalties: HashMap<u16, f32>,
Expand Down

0 comments on commit 4454b22

Please sign in to comment.