Downloads · 30 days
0
lollipopkit/arag-query-expand
arag-query-expand is a machine learning model from lollipopkit. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
面向 Qwen3-VL 的多模态 Query Expansion 训练脚手架,支持图片输入、结构化输出、多语言与多阶段训练(SFT/GRPO),并提供公开数据源与网页抓取的预留接口。
Downloads · 30 days
0
Access
Public
Updated Feb 5, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py47.8 KB · 78%
From the Hugging Face model README
面向 Qwen3-VL 的多模态 Query Expansion 训练脚手架,支持图片输入、结构化输出、多语言与多阶段训练(SFT/GRPO),并提供公开数据源与网页抓取的预留接口。
configs/:数据与训练配置scripts/:命令行入口src/:核心代码data/:本地数据(默认不入库)默认字段(可在 configs/pipeline.yaml 或 configs/data.yaml 调整):
lang
intent
entities
constraints
bm25
dense
hybrid
hyde
vision_ocr
vision_scene
vision_anchors
要求:每行一个字段,格式为 field: value。
manifest.jsonltrain.jsonl编辑 configs/pipeline.yaml 中 public_datasets 段落(已内置推荐数据集组合)。
export OPENAI_API_KEY=你的key
python scripts/prepare_pipeline.py --config configs/pipeline.yaml
生成结果:
data/manifest.jsonldata/train.jsonlpython scripts/resume_pipeline.py --config configs/pipeline.yaml
只查看进度:
python scripts/resume_pipeline.py --config configs/pipeline.yaml --status-only
强制重建 manifest:
python scripts/resume_pipeline.py --config configs/pipeline.yaml --rebuild-manifest
以下建议基于 4×16G 与 Qwen3-VL-2B-Instruct + QLoRA。
用途:快速 PoC、验证流程。
用途:可用的基础版本。
用途:稳定版本 + 多语种覆盖。
用途:长期优化。
配置文件:configs/sft.yaml
python scripts/run_sft.py --config configs/sft.yaml
关键参数建议:
model_name_or_path: Qwen/Qwen3-VL-2B-Instructuse_qlora: truemax_seq_len: 2048gradient_accumulation_steps: 8配置文件:configs/grpo.yaml
python scripts/run_grpo.py --config configs/grpo.yaml
奖励函数位于:src/train/rewards.py
默认包含:
format(结构完整)relevance(语义相关)diversity(bm25/dense/hybrid 多样性)vision_consistency(视觉一致性)language_consistency(语言一致性)说明:TRL 的 GRPO API 版本可能变化,如报错需按实际版本微调 src/train/grpo.py。
python scripts/expand.py \
--model Qwen/Qwen3-VL-2B-Instruct \
--image path/to/image.png \
--query "你的查询"
python scripts/build_manifest.py --config configs/pipeline.yaml
python scripts/generate_sft.py --config configs/pipeline.yaml
{"id":"1","type":"text","text":"段落内容","title":"标题","lang":"zh","image_path":null}
{"id":"2","type":"image","text":null,"title":"图片标题","lang":"en","image_path":"images/sample.jpg"}
{"id":"3","type":"multimodal","text":"说明文字","title":"标题","lang":"en","image_path":"images/sample.jpg"}
max_rows 或增加筛选规则。max_seq_len 或提高 gradient_accumulation_steps。vision_* 字段