wangzhengtao commited on
Commit
da977e1
·
1 Parent(s): 54383e8

support transformers inference

Browse files
Files changed (2) hide show
  1. config.json +4 -2
  2. modeling_kimi_k25.py +4 -4
config.json CHANGED
@@ -116,10 +116,12 @@
116
  },
117
  "format": "pack-quantized",
118
  "ignore": [
119
- "lm_head",
120
  "re:.*self_attn.*",
121
  "re:.*shared_experts.*",
122
- "re:.*mlp\\.(gate|up|gate_up|down)_proj.*"
 
 
 
123
  ],
124
  "kv_cache_scheme": null,
125
  "quant_method": "compressed-tensors",
 
116
  },
117
  "format": "pack-quantized",
118
  "ignore": [
 
119
  "re:.*self_attn.*",
120
  "re:.*shared_experts.*",
121
+ "re:.*mlp\\.(gate|up|gate_up|down)_proj.*",
122
+ "re:.*lm_head.*",
123
+ "re:vision_tower.*",
124
+ "re:mm_projector.*"
125
  ],
126
  "kv_cache_scheme": null,
127
  "quant_method": "compressed-tensors",
modeling_kimi_k25.py CHANGED
@@ -562,7 +562,8 @@ class MoonViT3dEncoder(nn.Module):
562
  hidden_dim: int,
563
  num_layers: int,
564
  block_cfg: dict,
565
- video_attn_type: str = 'spatial_temporal') -> None:
 
566
  super().__init__()
567
 
568
  assert video_attn_type == 'spatial_temporal', f'video_attn_type must be "spatial_temporal", got {video_attn_type}'
@@ -570,9 +571,8 @@ class MoonViT3dEncoder(nn.Module):
570
  self.rope_2d = Rope2DPosEmbRepeated(
571
  block_cfg['hidden_dim'] // block_cfg['num_heads'], 512, 512)
572
  self.blocks = nn.ModuleList([
573
- MoonViTEncoderLayer(
574
- **block_cfg,
575
- use_deterministic_attn=self.use_deterministic_attn)
576
  for _ in range(num_layers)
577
  ])
578
  self.final_layernorm = nn.LayerNorm(hidden_dim)
 
562
  hidden_dim: int,
563
  num_layers: int,
564
  block_cfg: dict,
565
+ video_attn_type: str = 'spatial_temporal',
566
+ use_deterministic_attn: bool = False) -> None:
567
  super().__init__()
568
 
569
  assert video_attn_type == 'spatial_temporal', f'video_attn_type must be "spatial_temporal", got {video_attn_type}'
 
571
  self.rope_2d = Rope2DPosEmbRepeated(
572
  block_cfg['hidden_dim'] // block_cfg['num_heads'], 512, 512)
573
  self.blocks = nn.ModuleList([
574
+ MoonViTEncoderLayer(**block_cfg,
575
+ use_deterministic_attn=use_deterministic_attn)
 
576
  for _ in range(num_layers)
577
  ])
578
  self.final_layernorm = nn.LayerNorm(hidden_dim)