mirror of
https://github.com/huggingface/candle.git
synced 2025-06-15 18:28:24 +00:00
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:
@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user