Please support prefetch with python datasets
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 20/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- python, tensorflow
- 領域
- data, machine-learning
調査の方向性
まず、tf.data.Dataset の prefetch および generator 関連のエントリーポイントを調査します。この issue ではリポジトリのファイルやテストは指定されていません。Python ジェネレーターと prefetch を使って報告された動作を再現し、その後、サポートされる動作と制約を特定します。完了の条件は、カスタム Python データセットの準備を、アクセラレーターの処理をブロックせずに prefetch できることを示す、合意済みの設計とテストが用意されることです。
索引モデルが issue の本文から書いたものです。
説明
Is your feature request related to a problem? Please describe.
There's a tremendous performance difference between datasets which are fully tensor end-to-end and datasets where some data wrangling happens in Python.
I was hoping to use "prefetch" to prepare data with the CPU while the GPU does work, but unfortunately, this only works if the data preparation is fully tensorflow-ish (? not sure the right term here)
Python IO operations are often exponentially slower and act as a bottleneck and prevent computers from keeping accelerators working at capacity.
Describe the solution you'd like
I wish tf.data.Dataset prefetch was more broadly compatible with prefetching of non-tensorflow vanilla-python data preparations.
Would it be possible for prefetch to use some performant C++ to sidestep Python GIL issues and juggle python data wrangling CPU processes alongside GPU training / inference without depending on such python CPU work happening in the main python driver process? I just want to be able to prefetch custom python datasets. Often there's some prep involved, not every dataset is tensorflow end-to-end.
i.e. instead of (python)->(gpu) what if it were
(python)->(cpp)
(cpp)->(python_prefetch)
(cpp)->(gpu/tpu accelerator)
Since C++ lacks a GIL, it could just run the python generator in a process which is isolated from the main python driver process' GIL, you'd still have a GIL per generator, but that's an easy fix, just run more python processes with different random seeds etc.
Describe alternatives you've considered
Torch DataLoader could be an option but it also seems to be a python-driven solution and therefore not super performant. I tried Threading, but pickling and unpickling overhead in python can be pretty bad. I think maybe C++ could run a background python process to prefetch python data in a more performant way than python could.
Additional context
Broader accessibility of custom dataset prefetching could enable new use-cases for tf.data especially in prototyping or infinite search spaces where it might not make sense to convert entire datasets to tensors in advance.
Apologies if I misunderstand the intricacies involved. I just want to prefetch datasets built from generators. I tried doing this last week but it didn't work, so hopefully I'm not mentioning an issue which is fixed and I missed a way to pull it off. It's hard to provide an example since the code in question is closed-source and quite extensive anyway. For a good example of when this might be handy, consider RL gym envs or datasets which involve making GET requests.
- 主要言語
- Python
- スター
- 4.6k
- フォーク
- 1.6k
- 平均マージ
- 14時間 3分
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tensorflow/datasets のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
tensorflow/datasets#11260 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
tensorflow/datasets#11253 ·
-
DatasetInfo.read_from_directory reads the deprecated FieldDescriptor.label eagerly, warning on every open対応中かも @jabrailkhalil が 48 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
tensorflow/datasets#11245 · コメント 1 件 ·
-
required dependency on importlib_resources missing対応中かも @ArS377 が 128 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
tensorflow/datasets#11212 · コメント 2 件 · リアクション 1 件 ·
-
C4 badwords filter: capitalized entries in upstream wordlists never match (text is lower-cased, list entries are not)対応中かも @Jefferyjia が 3 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 20/100
tensorflow/datasets#11258 ·
tensorflow/datasets の issue をすべて見る
似ている issue
-
difficulty:1 documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
MakazhanAlpamys/Soup#3533 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
onyx-dot-app/onyx#18730 ·
メンテナーはふだん 1 日以内に返信
-
namespace team:operations
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
EclipseFdn/open-vsx.org#16509 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
langflow-ai/langflow#16689 ·
メンテナーはふだん 1 日以内に返信
-
ScoringSystem.get() and compute() return NotImplementedError instead of raising it対応中かも @sc-lacanlale が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
aboutcode-org/vulnerablecode#2552 ·
メンテナーはふだん 5 日以内に返信