Skip to content

Commit 1845d91

Browse files
committed
Support GLM4 model
1 parent 2cb0a3e commit 1845d91

File tree

12 files changed

+1190
-28
lines changed

12 files changed

+1190
-28
lines changed

Cargo.lock

Lines changed: 3 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ schemars = "0.8.22"
125125
serde_yaml = "0.9.34"
126126
serde_plain = "1.0.2"
127127
as-any = "0.3.2"
128-
llguidance = { version = "0.7.29", default-features = false, features = ["lark"] }
129-
toktrie_hf_tokenizers = "0.7.29"
128+
llguidance = { git = "https://github.com/guidance-ai/llguidance.git", version = "0.7.29", default-features = false, features = ["lark"], rev = "2ce5ab8" }
129+
toktrie_hf_tokenizers = {git = "https://github.com/guidance-ai/llguidance.git", version = "0.7.29", rev = "2ce5ab8" }
130130
objc = { version = "0.2.7" }
131131
serde-big-array = "0.5.1"
132132
interprocess = "2.2.3"

mistralrs-core/src/layers.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,6 +2127,42 @@ impl Mlp {
21272127
})
21282128
}
21292129

2130+
pub fn new_merged(
2131+
vb: ShardedVarBuilder,
2132+
hidden_size: usize,
2133+
intermediate_size: usize,
2134+
chunks: usize,
2135+
quantization_config: &Option<QuantizedConfig>,
2136+
hidden_act: Activation,
2137+
comm: &Arc<mistralrs_quant::Comm>,
2138+
) -> Result<Self> {
2139+
assert!(chunks == 2, "Only gate_up_proj merge is supported!");
2140+
let gate_up_projs = ColumnParallelLayer::new_merged(
2141+
hidden_size,
2142+
intermediate_size * 2,
2143+
2,
2144+
quantization_config,
2145+
false,
2146+
comm,
2147+
vb.pp("gate_up_proj"),
2148+
)?;
2149+
2150+
Ok(Self {
2151+
gate: gate_up_projs[0].to_owned(),
2152+
up: gate_up_projs[1].to_owned(),
2153+
down: RowParallelLayer::new(
2154+
intermediate_size,
2155+
hidden_size,
2156+
quantization_config,
2157+
false,
2158+
comm,
2159+
vb.pp("down_proj"),
2160+
)?,
2161+
act: hidden_act,
2162+
params: vec![hidden_size, intermediate_size],
2163+
})
2164+
}
2165+
21302166
pub fn replicate(
21312167
params: &[usize],
21322168
vb: ShardedVarBuilder,

0 commit comments

Comments
 (0)