Agent: add model parameter estimation and dynamic size filtering#719
Merged
Conversation
- ConfigMetadataAnalyzer: add _estimate_param_count_billion() for rough param count estimation; analyze() now takes max_param_b to reject oversized models before extraction (prevents timeouts on 26B+ models) - ConfigMetadataAnalyzer: add _estimate_oom_risk() based on param count (>7B→high, >3B→medium) - GraphNetAgent: add max_model_size_b parameter and pass to analyzer - parallel_extract: add --max-model-size-b CLI arg (default 'auto'), auto-calculates from total_RAM × 0.7 / workers / 4
|
Thanks for your contribution! |
Xreki
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Feature Enhancement
Description
问题
超大模型(如 26B+ 参数)在抽取时会因为加载随机权重占用大量内存导致超时。典型案例:
01-ai/Yi-34B(39.7B 参数):加载 fp32 随机权重需要 ~159GB RAM,在 CPU 上抽取会阻塞数小时甚至永久挂起修改内容
1. 模型参数量预估 (
config_metadata_analyzer.py)_estimate_param_count_billion(config):基于 Transformer 架构的粗估公式_estimate_oom_risk(config):基于参数量做 OOM 风险分级analyze(max_param_b):在分析阶段(config.json 解析后)检查参数量MetadataAnalysisError,状态记为EXTRACT_FAILED2. Agent 参数透传 (
graph_net_agent.py)max_model_size_b: float = 20.0_analyze_model()透传max_param_b给 analyzer3. CLI 参数 (
parallel_extract.py)--max-model-size-b参数(默认"auto")"auto":按total_RAM(GB) × 0.7 / num_workers / 4自动计算--max-model-size-b 10表示上限 10B验证
参数量估计准确性
(粗估公式偏向保守,对超大模型是安全的)
端到端过滤测试
01-ai/Yi-34B(39.7B 参数,limit=20B):
效果
--max-model-size-b=auto根据机器配置自适应,避免手动调参