transformers pipelines with generator or dataset inputs record events before inference runs
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
调研方向
Start by reading the transformers Pipeline.call patch and the model forward hooks, then trace how a returned PipelineIterator is consumed. Reproduce with a generator input and compare event count, timing, and outputs with an eager call. Done means lazy inference is tracked at the intended granularity and forward hooks do not add per-item events.
由索引模型根据 Issue 内容生成。
描述
What happens
When a transformers pipeline is called with a generator, a dataset or another lazy input, Pipeline.__call__ returns a PipelineIterator, and inference runs only as that iterator is consumed. The integration's Pipeline.__call__ patch records its success event when __call__ returns, before any inference has run. Then each consumed item runs the model outside the tracked call, so the model's forward hooks record one event per item.
Checked with transformers 5.20.1 and the fix from #77:
| Call | Events |
|---|---|
clf("hello world") |
1 pipeline event (correct) |
out = clf(x for x in ["hello", "world"]) |
1 pipeline event right away: no input_meta, near-zero duration, before any inference |
list(out) |
2 more model events, one per item |
So two inputs produce three events, and the first one's duration and success don't describe any real inference.
Expected
For a lazy input, record one event per item as the iterator is consumed (with its duration and output), or one event when it's exhausted. No event should be recorded when __call__ returns the iterator. The model's forward hooks should stay quiet while the iterator is being consumed.
Notes
- This predates #77; #77 only stops eager calls from being counted twice.
Pipeline.__call__decides this based on input type (types.GeneratorType,Dataset,KeyDataset), so the patch can tell from the return value: aPipelineIteratoror another iterator instead of a list or dict.
🤖 Generated with Claude Code
- 主要语言
- Python
- 星标
- 17
- 派生
- 1
- 平均合并
- 17 小时 5 分钟
- 30 天内合并 PR
- 34
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
wild-edge/wildedge-python 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 45/100
wild-edge/wildedge-python#85 ·
维护者通常 1 天内回复
-
vLLM integration可能重新可做 @piotrekno1 于 122 天前认领,目前没有进行中的 PR。 未关闭
wild-edge/wildedge-python#38 · 已指派 1 人 ·
维护者通常 1 天内回复
-
enhancement good first issue help wanted
难度 3/5 1-2 天 新手友好度 48/100
wild-edge/wildedge-python#25 ·
维护者通常 1 天内回复
-
enhancement good first issue help wanted
难度 4/5 3-5 天 新手友好度 25/100
wild-edge/wildedge-python#22 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement good first issue help wanted
难度 3/5 1-2 天 新手友好度 35/100
wild-edge/wildedge-python#20 · 2 条评论 ·
维护者通常 1 天内回复
查看 wild-edge/wildedge-python 的全部 Issue
相似的 Issue
-
[oblt-aw][autodoc] Update workflow docs for gh-aw v0.92.5 and detector permission scope可能已有人在做 @github-actions 今天认领。 未关闭
难度 1/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
roadmap-100
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
comp/tools P2 tool/browser tool/file type/bug
难度 2/5 1-3 小时 新手友好度 75/100
NousResearch/hermes-agent#143418 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
python-hyper/uritemplate#164 ·