fix: fix the codegeex4 model examples and transformers model (#2738)

* Update main.rs

* Update codegeex4_9b.rs

* Get things to compile.

* Add some default for when rope_ratio is missing.

---------

Co-authored-by: Laurent <laurent.mazare@gmail.com>
This commit is contained in:
唐璜
2025-01-26 00:41:12 +08:00
committed by GitHub
parent 3164a19a5d
commit 333d94a19a
3 changed files with 60 additions and 40 deletions

View File

@ -8,6 +8,10 @@ use crate::models::with_tracing::{linear_b as linear, Linear};
use candle::{DType, Device, IndexOp, Module, Result, Tensor, D};
use candle_nn::VarBuilder;
fn default_one() -> usize {
1
}
#[derive(Debug, Clone, serde::Deserialize, Default)]
pub struct Config {
pub num_layers: usize,
@ -29,6 +33,7 @@ pub struct Config {
pub apply_query_key_layer_scaling: bool,
pub attention_softmax_in_fp32: bool,
pub fp32_residual_connection: bool,
#[serde(default = "default_one")]
pub rope_ratio: usize,
}