Add the StarCoder2 model. (#1779)

* Add the StarCoder2 model.

* Add the example code and get things to work.

* And also tweak the readme.
This commit is contained in:
Laurent Mazare
2024-02-28 21:02:41 +01:00
committed by GitHub
parent 57267cd536
commit 4fd00b8900
6 changed files with 609 additions and 3 deletions

View File

@ -5,6 +5,7 @@ use serde::Deserialize;
#[serde(rename_all = "lowercase")]
pub enum Activation {
#[default]
#[serde(alias = "gelu")]
Gelu,
#[serde(alias = "gelu_new")]
NewGelu,
@ -19,6 +20,8 @@ pub enum Activation {
HardSwish,
Elu(f64),
LeakyRelu(f64),
#[serde(alias = "gelu_pytorch_tanh")]
GeluPytorchTanh,
}
impl super::Module for Activation {
@ -38,6 +41,7 @@ impl super::Module for Activation {
Self::HardSwish => xs * crate::ops::hard_sigmoid(xs)?,
&Self::Elu(alpha) => xs.elu(alpha),
&Self::LeakyRelu(negative_slope) => crate::ops::leaky_relu(xs, negative_slope),
Self::GeluPytorchTanh => xs.gelu(),
}
}
}