This is 100% #JuliaLang code. It trains a dense neural network using the #Keras Python library. If you replace the first 3 lines with "import tensorflow as tf; from tensorflow import keras", you can run the exact same code in Python. Talk about excellent interoperability!
Replying to
Such an interesting call! I mean, how useful is to try this tool enhancing the speed by using Julia. I would like to know if JuliaML.jl gives or not a better result than you presented?
Replying to
Pretty interesting.
what are your thoughts on Julia? Do you think it will take over Python for ML/DL use cases?
2
Replying to
cool. what's the advantage of running this code in julia as opposed to python?
1
3
Good question! This example just shows that you can use any Python library in Julia. This makes it easier to transition from Python to Julia.
1
7
thanks. I am keeping an eye out for julia. One reason I focus on python is the ML ecosystem. Wouldn't natively built julia packages be better? what about compatibility issues?
3
2
Pure Julia code is 10x to 100x faster than pure Python code, in most cases. It can even be faster than Python C modules, like NumPy, in some cases. For example sin.(cos.(exp.(A))) in Julia will iterate over the array A just once, whereas NumPy would create 2 temporary arrays.
Replying to
I did not realize that you could use Python in Julia. That's amazing and I'm going to give Julia a much better look now.
1
2
Cool! Check out my Julia tutorial for Python programmers: https://colab.research.google.com/github/ageron/julia_notebooks/blob/master/Julia_for_Pythonistas.ipynb…
Hope you find it useful.
1
Replying to
Can the model be saved and used for future inference in julia just like python?
Replying to
I didn’t try it before so I don’t know the performance, is there a difference in performance ?
Replying to
That's super interesting! Do you know the performance implications of running this? Will it be at least as fast as the original Python?
1
3
Actually, I think a better question is: can I get performance benefits from mixing Julia and Python, or will everything that interacts with the Python run in the Python interpreter?
1
1
I haven't run any benchmarks on this, but I assume that everything that interacts with Python runs at Python speed, plus a small overhead due to the conversion. But that overhead is small as Python runs in the Julia process itself. The benefit is interoperability, not speed.
1
3
Aha, thanks! So—potentially—we can write nice, fast data transformation code in Julia before feeding the data into a Python training loop.
1
4
Yes, you could do that. However, in the long term Julia solves the two-language problem, where you need one language for high level stuff and another for low level. With Julia, you can write high level code and it will run fast.
No comments:
Post a Comment