Deep learning in pythonista .?
Does pythonista currently supports any deep learning module .(via stash ) I love pythonista for what all it can do but having just basic deep learning would be so awesome.. just to learn
I tried a deep learning module npdl in pythonista it inported wothout error but always seems to get stuck at model.fit()
Most Python machine learning libraries are written in native code (C, C++, Assembly, Fortran, etc.), so you cannot install them in Pythonista (because of iOS restrictions).
npdlis a bit different, it uses only pure Python and
numpy, so it should be usable in Pythonista.
If your code hangs on the
model.fitcall, maybe it just takes a while to run? Depending on what your device is, your code will run much slower than on a normal computer, especially for code that requires a lot of computation. Try letting it run for a few minutes and see if anything happens. (If your device gets warm, you can tell that it's still doing something.
Note: I know nothing about machine learning, so I can't help very much, sorry.
Yeah I tried it on my iPhone 5s and let it run for 3-4 minutes .. i just wanted to know if it was actually running and working on more powerful devices ir not .?
Post some script (+ what to install), so, I can run it on iPad Pro and will let you know for how long it runs.
Well i just pip installed npdl
Then git cloned this repo:
And ran the lstm-character.py in examples folder
But it hung on train model
I figured there were too many characters in tiny shakespeare.txt
So i reduced them but it still didnt went past the train model..
However its working fine in my pc .. still took a lot of time though
Here're results from the iPad Pro 2nd gen 12.9". I had to change max iterations to 10, it took much longer with 100.
Started: 2017-09-18 10:50:13.803954 data has 1115389 charactres, 65nique. Building model ... Train model ... iter 1, train-[loss 4.1734, acc 0.0362]; iter 2, train-[loss 4.1724, acc 0.0362]; iter 3, train-[loss 4.1714, acc 0.0375]; iter 4, train-[loss 4.1704, acc 0.0375]; iter 5, train-[loss 4.1695, acc 0.0400]; iter 6, train-[loss 4.1685, acc 0.0413]; iter 7, train-[loss 4.1675, acc 0.0437]; iter 8, train-[loss 4.1665, acc 0.0437]; iter 9, train-[loss 4.1655, acc 0.0462]; iter 10, train-[loss 4.1646, acc 0.0475]; Started: 2017-09-18 10:50:13.803954, Ended: 2017-09-18 11:21:58.137529 Duration: 1904.333575
Approximately 32 minutes. You should run these tasks on a computer as @dgelessus already mentioned. These pure Python implementations will be always slow.
Oh wow thanks .. decreasing the max iter definitely helped and i also found out that decreasing the n_out to 30(from 300) ie reducing the no of nodes made it a lot faster
Just run it on my desktop (MacBook Pro (15-inch, Late 2016), 2,9 GHz Intel Core i7, 16 GB 2133 MHz LPDDR3) for fun ...
/Users/robertvojta/anaconda/bin/python3 /Users/robertvojta/Work/purposefly/NumpyDL/examples/lstm-character-lm.py Started: 2017-09-18 22:14:10.355194 data has 1115389 charactres, 65nique. Building model ... Train model ... iter 1, train-[loss 4.1730, acc 0.0262]; iter 2, train-[loss 4.1716, acc 0.0262]; iter 3, train-[loss 4.1702, acc 0.0262]; iter 4, train-[loss 4.1688, acc 0.0262]; iter 5, train-[loss 4.1674, acc 0.0250]; iter 6, train-[loss 4.1660, acc 0.0262]; iter 7, train-[loss 4.1646, acc 0.0262]; iter 8, train-[loss 4.1632, acc 0.0275]; iter 9, train-[loss 4.1619, acc 0.0288]; iter 10, train-[loss 4.1605, acc 0.0300]; Started: 2017-09-18 22:14:10.355194, Ended: 2017-09-18 22:15:04.876571 Duration: 54.521377
... and the result is less than one minute, 32x faster :) Okay, it's not just about desktop vs iPad, but also pure Python vs optimized NumPy libs, ...
Haha yeah pure python libraries are indeed slower
iOS 11 has a deep learning api in it
For pretrained models.