Fixing Qwen 2.5 VL (32B).

Reduce the config constraints, and use common ground between the 8B and
32B.
This commit is contained in:
Nicolas Patry 2025-04-09 16:10:32 +02:00
parent 0b28aabb94
commit 33af4dcd6c
No known key found for this signature in database
GPG Key ID: 87B37D879D09DEB4

View File

@ -323,20 +323,20 @@ impl Qwen2Vl {
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub struct Qwen2_5VlVisionConfig { pub struct Qwen2_5VlVisionConfig {
pub(crate) depth: usize, // pub(crate) depth: usize,
pub(crate) hidden_act: String, // pub(crate) hidden_act: String,
pub(crate) hidden_size: usize, // pub(crate) hidden_size: usize,
pub(crate) intermediate_size: usize, // pub(crate) intermediate_size: usize,
pub(crate) num_heads: usize, // pub(crate) num_heads: usize,
pub(crate) in_chans: usize, // pub(crate) in_chans: usize,
pub(crate) out_hidden_size: usize, // pub(crate) out_hidden_size: usize,
pub(crate) patch_size: usize, // pub(crate) patch_size: usize,
pub(crate) spatial_merge_size: usize, // pub(crate) spatial_merge_size: usize,
pub(crate) spatial_patch_size: usize, pub(crate) spatial_patch_size: usize,
pub(crate) window_size: usize, // pub(crate) window_size: usize,
pub(crate) fullatt_block_indexes: Vec<usize>, // pub(crate) fullatt_block_indexes: Vec<usize>,
pub(crate) tokens_per_second: usize, // pub(crate) tokens_per_second: usize,
pub(crate) temporal_patch_size: usize, // pub(crate) temporal_patch_size: usize,
} }
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
@ -348,7 +348,7 @@ pub struct Qwen2_5Vl {
impl Qwen2_5Vl { impl Qwen2_5Vl {
pub fn get_number_of_features(&self, height: usize, width: usize) -> usize { pub fn get_number_of_features(&self, height: usize, width: usize) -> usize {
let num_pixels = height * width; let num_pixels = height * width;
num_pixels / self.vision_config.patch_size.pow(2) num_pixels / self.vision_config.spatial_patch_size.pow(2)
} }
} }