feat: DeepSeek V4 Flash 0731 added
This commit is contained in:
@@ -1985,7 +1985,7 @@ impl SsdPlan {
|
||||
let mut by_layer = vec![Vec::<(i32, u32)>::new(); model.shape.layers as usize];
|
||||
let mut loaded = 0_u32;
|
||||
let hotlist = match model.shape.model {
|
||||
ModelChoice::DeepSeekV4Flash => hotlist::FLASH,
|
||||
ModelChoice::DeepSeekV4Flash | ModelChoice::DeepSeekV4Flash0731 => hotlist::FLASH,
|
||||
ModelChoice::DeepSeekV4Pro => hotlist::PRO,
|
||||
ModelChoice::Glm52 => unreachable!("GLM uses its dedicated executor"),
|
||||
};
|
||||
@@ -3437,12 +3437,14 @@ impl DeepSeekExecutor {
|
||||
if self.session.position == 0 && self.ssd.is_some() {
|
||||
unsafe { ds4_gpu_stream_expert_cache_reset_route_hotness() };
|
||||
}
|
||||
let streaming_decode_cap = if self.model.shape.model == ModelChoice::DeepSeekV4Flash
|
||||
&& self.weights.layers.first().is_some_and(|layer| {
|
||||
layer.expert_gate.kind == Q4_K
|
||||
&& layer.expert_up.kind == Q4_K
|
||||
&& layer.expert_down.kind == Q4_K
|
||||
}) {
|
||||
let streaming_decode_cap = if matches!(
|
||||
self.model.shape.model,
|
||||
ModelChoice::DeepSeekV4Flash | ModelChoice::DeepSeekV4Flash0731
|
||||
) && self.weights.layers.first().is_some_and(|layer| {
|
||||
layer.expert_gate.kind == Q4_K
|
||||
&& layer.expert_up.kind == Q4_K
|
||||
&& layer.expert_down.kind == Q4_K
|
||||
}) {
|
||||
64
|
||||
} else {
|
||||
18
|
||||
@@ -6469,16 +6471,23 @@ fn update_compressor_stage(
|
||||
|
||||
fn compression_ratio(shape: super::Shape, layer: u32) -> u32 {
|
||||
match shape.model {
|
||||
crate::model::ModelChoice::DeepSeekV4Flash if layer < 2 => 0,
|
||||
crate::model::ModelChoice::DeepSeekV4Flash
|
||||
| crate::model::ModelChoice::DeepSeekV4Flash0731
|
||||
if layer < 2 =>
|
||||
{
|
||||
0
|
||||
}
|
||||
crate::model::ModelChoice::DeepSeekV4Pro if layer < 2 => 128,
|
||||
crate::model::ModelChoice::DeepSeekV4Flash | crate::model::ModelChoice::DeepSeekV4Pro
|
||||
crate::model::ModelChoice::DeepSeekV4Flash
|
||||
| crate::model::ModelChoice::DeepSeekV4Flash0731
|
||||
| crate::model::ModelChoice::DeepSeekV4Pro
|
||||
if layer.is_multiple_of(2) =>
|
||||
{
|
||||
4
|
||||
}
|
||||
crate::model::ModelChoice::DeepSeekV4Flash | crate::model::ModelChoice::DeepSeekV4Pro => {
|
||||
128
|
||||
}
|
||||
crate::model::ModelChoice::DeepSeekV4Flash
|
||||
| crate::model::ModelChoice::DeepSeekV4Flash0731
|
||||
| crate::model::ModelChoice::DeepSeekV4Pro => 128,
|
||||
crate::model::ModelChoice::Glm52 => 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,10 +223,11 @@ pub(super) fn validate_main(model: &Gguf, expected: ModelChoice) -> Result<Shape
|
||||
};
|
||||
let shape = match family {
|
||||
ModelFamily::Glm => GLM,
|
||||
ModelFamily::DeepSeek => match model.u32("deepseek4.block_count")? {
|
||||
43 => FLASH,
|
||||
61 => PRO,
|
||||
layers => return Err(format!("unsupported DeepSeek layer count: {layers}")),
|
||||
ModelFamily::DeepSeek => match (model.u32("deepseek4.block_count")?, expected) {
|
||||
(43, ModelChoice::DeepSeekV4Flash0731) => FLASH_0731,
|
||||
(43, _) => FLASH,
|
||||
(61, _) => PRO,
|
||||
(layers, _) => return Err(format!("unsupported DeepSeek layer count: {layers}")),
|
||||
},
|
||||
};
|
||||
if shape.model != expected {
|
||||
@@ -993,10 +994,18 @@ fn float_eq(actual: f32, expected: f32) -> bool {
|
||||
|
||||
fn compression_ratio(shape: &Shape, layer: u32) -> u32 {
|
||||
match shape.model {
|
||||
ModelChoice::DeepSeekV4Flash if layer < 2 => 0,
|
||||
ModelChoice::DeepSeekV4Flash | ModelChoice::DeepSeekV4Flash0731 if layer < 2 => 0,
|
||||
ModelChoice::DeepSeekV4Pro if layer < 2 => 128,
|
||||
ModelChoice::DeepSeekV4Flash | ModelChoice::DeepSeekV4Pro if layer.is_multiple_of(2) => 4,
|
||||
ModelChoice::DeepSeekV4Flash | ModelChoice::DeepSeekV4Pro => 128,
|
||||
ModelChoice::DeepSeekV4Flash
|
||||
| ModelChoice::DeepSeekV4Flash0731
|
||||
| ModelChoice::DeepSeekV4Pro
|
||||
if layer.is_multiple_of(2) =>
|
||||
{
|
||||
4
|
||||
}
|
||||
ModelChoice::DeepSeekV4Flash
|
||||
| ModelChoice::DeepSeekV4Flash0731
|
||||
| ModelChoice::DeepSeekV4Pro => 128,
|
||||
ModelChoice::Glm52 => 0,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user