apply_vocabulary lookup table initialization needs to be wrapped inside `tf.init_scope`
@varshaan ci sta già lavorando.
Dal 18/11/2021.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
We recently encountered scalability issues when trying to apply the vocabularies for multiple (5 to be exact) categorical features. We saw multiple lines of the follwoing warning message:
WARNING:tensorflow:Tables initialized inside a tf.function will be re-initialized on every invocation of the function. This re-initialization can have significant impact on performance. Consider lifting them out of the graph context using `tf.init_scope`.
When using the tft.apply_vocabulary, the job would stuck on the transformation steps for hours, consuming thousands of CPU hours if we do not kill it early.
Creating a custom lookup table initialization function like the following could bypass the proble; 80M rows of data only took 35 min, consuming ~20 hours of CPU time.
def create_file_lookup(filename):
with tf.init_scope():
initializer = tf.lookup.TextFileInitializer(
filename,
key_dtype=tf.string,
key_index=tf.lookup.TextFileIndex.WHOLE_LINE,
value_dtype=tf.int64,
value_index=tf.lookup.TextFileIndex.LINE_NUMBER,
value_index_offset=1, # starting from 1
)
table = tf.lookup.StaticHashTable(initializer, 0)
return table
Relevant code need to be addressed:
https://github.com/tensorflow/transform/blob/520ebb492c2f687ff30cce22261938037384b26d/tensorflow_transform/mappers.py#L1114
This probably needs to be applied to versions of TFT starting from 1.0
- Lingua principale
- Python
- Stelle
- 989
- Fork
- 225
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri 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/transform
-
stat:contributions welcome type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
tensorflow/transform#347 ·
-
bug stat:awaiting response
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
tensorflow/transform#339 · 2 commenti ·
-
stat:contributions welcome type:bug
tensorflow/transform#273 · 1 assegnatario ·
-
stat:contributions welcome type:support
tensorflow/transform#272 · 4 commenti · 1 assegnatario ·
-
stat:contributions welcome type:bug
tensorflow/transform#265 · 3 commenti · 2 assegnatari ·
Tutte le issue di tensorflow/transform
Issue simili
-
bug confirmed issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
open-webui/open-webui#30750 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100