dask/dask-examples

Use an already trained Keras model to predict on lots of data

Offen

#35 geöffnet am 31.08.2018

 (17 Kommentare) (1 Reaktion) (0 zugewiesene Personen)Jupyter Notebook (225 Forks)auto 404
help wanted

Repository-Metriken

Stars
 (386 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

A common approach is to train on a bit of data and then use that trained model to predict on lots of data. We could do this using ParallelPostFit in dask-ml, or we can use X.map_blocks or df.map_partitions. In either case we might want to be a bit careful about avoiding repeated serializations costs. For example, in the following case I suspect that we include the serialized model in every task

# maybe bad?
model = load_model()
predictions = X.map_blocks(model.predict)  

It's probably better to encourage the user to keep the model delayed

# maybe bad?
model = dask.delayed(load_model)()
predictions = X.map_blocks(model.predict)  

We should also ensure that dask-ml does this correctly, and includes the model as a single task in the graph so that it gets sent around appropriately (cc @TomAugspurger )

I'm also generally curious if a Keras model that lives on the GPU will eventually make its way back onto the GPU when deserializing.

Contributor Guide