patch_dspark_skip_bias_vl.py 1006 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env python3
  2. """Skip Vision-Exp gate tensors the B12X DSpark draft loader cannot bind."""
  3. from pathlib import Path
  4. p = Path("/usr/local/lib/python3.12/dist-packages/vllm/models/deepseek_v4/nvidia/dspark.py")
  5. text = p.read_text()
  6. old = ''' if name.endswith(".ffn.gate.bias"):
  7. name = name.replace(
  8. ".ffn.gate.bias", ".ffn.gate.e_score_correction_bias"
  9. )
  10. param = params_dict[name]
  11. '''
  12. new = ''' if name.endswith(".ffn.gate.bias_vl"):
  13. continue
  14. if name.endswith(".ffn.gate.bias"):
  15. name = name.replace(
  16. ".ffn.gate.bias", ".ffn.gate.e_score_correction_bias"
  17. )
  18. if name not in params_dict:
  19. continue
  20. param = params_dict[name]
  21. '''
  22. if old not in text:
  23. raise SystemExit(f"patch target missing in {p}")
  24. p.write_text(text.replace(old, new, 1))