evilsocket / pwnagotchi

(⌐■_■) - Deep Reinforcement Learning instrumenting bettercap for WiFi pwning.
https://pwnagotchi.ai/
Other
7.42k stars 1.14k forks source link

find a way to optimize AI loading times #166

Open evilsocket opened 4 years ago

evilsocket commented 4 years ago

TensorFlow takes minutes to import on a Raspberry Pi Zero W and that's probably because of the huge .so file with native primitives it has to load, among other things. Given the nature of the project, that stuff is imported only once, so caching it in memory wouldn't speed things up. Switching frameworks is not feasible, unless we have the same exact features (unlikely given that stable-baselines is TF based). For instance, there's no stable-baselines port for TF-lite.

evilsocket commented 4 years ago

@caquino this is a nice hacktoberfest entry

caquino commented 4 years ago

:+1:

araffin commented 4 years ago

Switching frameworks is not feasible, unless we have the same exact features (unlikely given that stable-baselines is TF based).

I think the two main things that takes time:

EDIT: Regarding issue #49, CMA-ES (which has a nice python package) is usually a good start

evilsocket commented 4 years ago

@araffin thanks for your feedback!

For #49 I already have my own implementation, but thanks :D

d3sm0 commented 4 years ago

Importing stable baseline, all old tensorflow (works on v1 not v2) which loads all the tf graph in memory the first time, instead of compiling at run time, makes way to heavy.

Maybe one can rewrite a2c tuned for this application and use (not sure if you are already doing this) a compiled version for rasberry. This should reduce loading time quite a bit.

As a side: LSTM is computationally heavy to run (complexity is on the size of the features) and it make sense if you have long time dependencies in your time-series. Is this the case? One can try to use 1d convolution (complexity is on number of samples) which are more suitable for time-series kind of signal.

evilsocket commented 4 years ago

As a side: LSTM is computationally heavy to run (complexity is on the size of the features) and it make sense if you have long time dependencies in your time-series. Is this the case?

yes