Skip to content

feat(token_compressor): introduce universal pruning framework and ali…#238

Open
YF-T wants to merge 4 commits intoTencent:mainfrom
YF-T:token_compressor
Open

feat(token_compressor): introduce universal pruning framework and ali…#238
YF-T wants to merge 4 commits intoTencent:mainfrom
YF-T:token_compressor

Conversation

@YF-T
Copy link

@YF-T YF-T commented Feb 3, 2026

…gn with Transformers v5.0

Major update to the token compression module, introducing a metadata-driven architecture for visual token pruning and merging. This refactor aligns model wrappers with Transformers v5.0 standards to ensure future-proof compatibility and cleaner activation propagation.

Key changes:

  • Integrated UniversalPruningAdapter: A metadata-driven engine that dynamically wraps model components (CLIP/Llama/Qwen) based on YAML mappings.
  • Implemented PruningContext with Dynamic Synchronization: Added support for negative indexing and property setters to automatically sync layer counts.
  • Added Comprehensive Algorithm Suite: Integrated SOTA strategies including IDPruner (MMR), VisionZip, VisPruner, SCOPE, HiPrune, and FastV.
  • Modular Model Support: Added dedicated prunable wrappers for Qwen2.5-VL and LLaVA-1.5.
  • Transformers v5.0 Alignment: Refactored forward pass logic to use **kwargs propagation for context passing.
  • Enhanced Evaluation Pipeline: Created run_pruning_eval.py and test_universal_pruning.py for automated benchmarking.
  • Added comprehensive YAML strategy library in configs/ for Qwen and LLaVA.

Copyright 2026 Tencent Inc. All Rights Reserved.

…gn with Transformers v5.0

Major update to the token compression module, introducing a metadata-driven
architecture for visual token pruning and merging. This refactor aligns model
wrappers with Transformers v5.0 standards to ensure future-proof compatibility
and cleaner activation propagation.

Key changes:
- Integrated UniversalPruningAdapter: A metadata-driven engine that dynamically
  wraps model components (CLIP/Llama/Qwen) based on YAML mappings.
- Implemented PruningContext with Dynamic Synchronization: Added support for
  negative indexing and property setters to automatically sync layer counts.
- Added Comprehensive Algorithm Suite: Integrated SOTA strategies including
  IDPruner (MMR), VisionZip, VisPruner, SCOPE, HiPrune, and FastV.
- Modular Model Support: Added dedicated prunable wrappers for Qwen2.5-VL and LLaVA-1.5.
- Transformers v5.0 Alignment: Refactored forward pass logic to use **kwargs
  propagation for context passing.
- Enhanced Evaluation Pipeline: Created run_pruning_eval.py and
  test_universal_pruning.py for automated benchmarking.
- Added comprehensive YAML strategy library in configs/ for Qwen and LLaVA.

Copyright 2026 Tencent Inc. All Rights Reserved.
YF-T added 2 commits February 3, 2026 19:26
- Add IDPruner core algorithm section with benchmark results
- Add baseline pruning methods and evaluation guide
- Update installation guide with multimodal and lmms-eval dependencies
- Add developer guide for creating custom pruning strategies
Copy link
Collaborator

@yghstill yghstill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-commit格式化下代码格式

@classmethod
def from_yaml(cls, path: str) -> "TokenCompressorConfig":
"""
解析 YAML 配置文件并返回结构化的 TokenCompressorConfig 对象。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释都用英文

# limitations under the License.

from .engine import Engine # noqa: F401
# from .engine import Engine # noqa: F401
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不能注释这里

@@ -0,0 +1,35 @@
#!/bin/bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scripts/pruning/eval_qwen2_5_vl_visionzip_r0.9.sh是个空文件?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants