Please support prefetch with python datasets
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- python, tensorflow
- Ambito
- data, machine-learning
Direzione di ricerca
Inizia esaminando gli entry point di tf.data.Dataset relativi a prefetch e ai generatori; l’issue non indica file o test del repository. Riproduci il comportamento segnalato con un generatore Python e prefetch, quindi determina il comportamento supportato e i vincoli. Il lavoro sarà completato quando saranno disponibili un design concordato e test che dimostrino che la preparazione personalizzata di dataset Python può essere eseguita in prefetch senza bloccare il lavoro dell’acceleratore.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 4.6k
- Fork
- 1.6k
- Merge medio
- 14h 3m
- PR unite (30g)
- 5
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tensorflow/datasets
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tensorflow/datasets#11260 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
tensorflow/datasets#11253 ·
-
DatasetInfo.read_from_directory reads the deprecated FieldDescriptor.label eagerly, warning on every openForse già presa @jabrailkhalil l’ha presa 48 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tensorflow/datasets#11245 · 1 commento ·
-
required dependency on importlib_resources missingForse già presa @ArS377 l’ha presa 128 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
tensorflow/datasets#11212 · 2 commenti · 1 reazione ·
-
C4 badwords filter: capitalized entries in upstream wordlists never match (text is lower-cased, list entries are not)Forse già presa @Jefferyjia l’ha presa 3 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 20/100
tensorflow/datasets#11258 ·
Tutte le issue di tensorflow/datasets
Issue simili
-
docs: powerpc not supportedAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
microsoft/TokenEconomizer#360 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
reasons-gate
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
benthomasson/reasons-service#190 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno