Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

transformers pipelines with generator or dataset inputs record events before inference runs

未关闭
#78 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
huggingface, python, pytorch

调研方向

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: a PipelineIterator or 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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

wild-edge/wildedge-python 的其他 Issue

查看 wild-edge/wildedge-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。