omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Deep learning in pythonista .?

    Pythonista
    machine learnin deep learning
    5
    11
    14912
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dgelessus
      dgelessus last edited by

      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). npdl is a bit different, it uses only pure Python and numpy, so it should be usable in Pythonista.

      If your code hangs on the model.fit call, 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.

      1 Reply Last reply Reply Quote 1
      • Kush
        Kush last edited by

        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 .?

        1 Reply Last reply Reply Quote 0
        • zrzka
          zrzka last edited by

          Post some script (+ what to install), so, I can run it on iPad Pro and will let you know for how long it runs.

          1 Reply Last reply Reply Quote 1
          • Kush
            Kush last edited by

            Well i just pip installed npdl
            Then git cloned this repo:
            https://github.com/oujago/NumpyDL
            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

            1 Reply Last reply Reply Quote 0
            • zrzka
              zrzka last edited by

              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.

              1 Reply Last reply Reply Quote 1
              • Kush
                Kush last edited by Kush

                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

                1 Reply Last reply Reply Quote 0
                • zrzka
                  zrzka last edited by

                  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, ...

                  1 Reply Last reply Reply Quote 1
                  • Kush
                    Kush last edited by Kush

                    Haha yeah pure python libraries are indeed slower

                    1 Reply Last reply Reply Quote 0
                    • ellie_ff1493
                      ellie_ff1493 last edited by

                      iOS 11 has a deep learning api in it

                      1 Reply Last reply Reply Quote 0
                      • chibill
                        chibill last edited by

                        For pretrained models.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Powered by NodeBB Forums | Contributors