However for App development Swift of course has a far more impressive stack.
Swift for TensorFlow – A system for deep learning and differentiable computing
121–130 of 142 posts
Re: Swift for TensorFlow – A system for deep learning and differentiable computing
#122Earlier quoted context omitted.
Speed, too. For PyTorch to train models and run inference quickly, your Python code gets translated to C++/CUDA. Part of the idea with S4TF is to be able to write ML code in a single, fast language.
Well, it's not happening in swift yet. S4TF still requires either c cuda kernels or XLA. Julia on the other hand has JIT GPU codegen and its CPU codegen has been benchmarked to beat openblas
Source on this claim?
Re: Swift for TensorFlow – A system for deep learning and differentiable computing
#123Earlier quoted context omitted.
Well, it's not happening in swift yet. S4TF still requires either c cuda kernels or XLA. Julia on the other hand has JIT GPU codegen and its CPU codegen has been benchmarked to beat openblas
> CPU codegen has been benchmarked to beat openblas Source on this claim?
https://discourse.julialang.org/t/realistically-how-close-is...
https://github.com/mcabbott/Tullio.jl
Regardless if it can consistently beat Fortran/BLAS in every area, in general JIT languages have more opportunities for optimizations than AoT languages, so it's interesting to see what comes out of a language that focuses on leveraging this to get the most performance.
Re: Swift for TensorFlow – A system for deep learning and differentiable computing
#124Earlier quoted context omitted.
In your first sentence you're mistaking JAX and XLA XLA: Accelerated Linear Algebra, I guess it's kind of a backend/compiler that optimizes Linear Algebra/Deep Learning calculations with some very interesting techniques, among them fusing kernels JAX: In some sense syntax sugar over XLA, but a better way of describing it is Composable transformations + Numpy + some Scipy. The composable transformations allow you to t…
im not mistaking the articles around it - check this out: https://www.tensorflow.org/probability/examples/TensorFlow_P... "TensorFlow Probability (TFP) is a library for probabilistic reasoning and statistical analysis that now works on JAX! For those not familiar, JAX is a library for accelerated numerical computing based on composable function transformations. We have ported a lot of TFP's most useful functionality…
We are not migrating away from TF; far from it!
The change here was to interoperate with TF and JAX (and numpy!), by way of some rewrite trickery under the hood. Essentially, we wrote a translation layer that implements the TF API surface (or, the parts we actually use) in terms of numpy & JAX primitives [1]. This lets us leave most TFP code intact, written in terms of the TF API, but interoperate with JAX by way of the API translation layer. (Actually we implemented numpy support first, and mostly got JAX for "free" since JAX is largely API-compatible with numpy).
Sorry for any confusion!
We're pretty stoked about this work, so happy to answer any other questions you may have (also feel free to chime in on the github tracker or email tfprobability@tensorflow.org)
[1] - https://github.com/tensorflow/probability/tree/master/tensor...
Re: Swift for TensorFlow – A system for deep learning and differentiable computing
#125Earlier quoted context omitted.
I see, interesting! Yeah statically checking this would be way more awesome still
Oh I just noticed that you're one of the people behind that recent GAN compression work! Really cool stuff and a big step up this year, I've been following the field for a lil bit. Congrats!
Re: Swift for TensorFlow – A system for deep learning and differentiable computing
#126Earlier quoted context omitted.
I agree on the hardware part. MacOS only supports AMD GPUs which are unsupported by Tensor flow...
Tensorflow can work with ROCM which is equivalent to Nvidia's CUDA.
Re: Swift for TensorFlow – A system for deep learning and differentiable computing
#127Earlier quoted context omitted.
Anyone who is avoiding "master, black list or sanity check" probably thinks abortion is super awesome and that the term "abort" should never be stigmatized. Best not to worry about such silly things and keep writing code.
I don't know of anyone who "thinks abortion is super awesome"... In any case, the primary meaning of 'abort' is more general, so it shouldn't be compared to the metaphorical use of 'stillborn'.
Re: Swift for TensorFlow – A system for deep learning and differentiable computing
#128Earlier quoted context omitted.
Tensorflow can work with ROCM which is equivalent to Nvidia's CUDA.
There is no official support, only AMD's custom TF branch. Further ROCM itself works only on Linux. I believe most people writing Swift are using MacOS.
Re: Swift for TensorFlow – A system for deep learning and differentiable computing
#129Earlier quoted context omitted.
There is no official support, only AMD's custom TF branch. Further ROCM itself works only on Linux. I believe most people writing Swift are using MacOS.
And Julia can do custom ROCM codegen, either by itself or through array and kernel abstractions :) https://github.com/JuliaGPU/AMDGPU.jl https://juliagpu.gitlab.io/KernelAbstractions.jl/ https://github.com/JuliaGPU/GPUArrays.jl/pulse
Re: Swift for TensorFlow – A system for deep learning and differentiable computing
#130Earlier quoted context omitted.
I know where you're coming from, but TF in my opinion was very user-hostile even on arrival. I can't tell you how much hair-pulling I did over tf.conds, tf.while_loops and the whole gather / scatter paradigm for simple indexing into arrays. I really think the people working on it wanted users to write TF code in a certain, particular way and made it really difficult to use it in other ways. Just thinking back on that…
> tf.conds, tf.while_loops and the whole gather / scatter paradigm I'm ill-informed - but isn't that exactly what lax is?
In [1]: from jax import grad
In [2]: def f(x):
...: if x > 0:
...: return 3. * x ** 2
...: else:
...: return 5. * x ** 3
...:
In [3]: grad(f)(1.)
Out[3]: DeviceArray(6., dtype=float32)
In [4]: grad(f)(-1.)
Out[4]: DeviceArray(15., dtype=float32)
In the above example, the control flow happens in Python, just as it would in PyTorch. (That's not surprising, since JAX grew out of the original Autograd [1]!)Structured control flow functions like lax.cond, lax.scan, etc exist so that you can, for example, stage control flow out of Python and into an end-to-end compiled XLA computation with jax.jit. In other words, some JAX transformations place more constraints on your Python code than others, but you can just opt into the ones you want. (More generally, the lax module lets you program XLA HLO pretty directly [2].)
Disclaimer: I work on JAX!
[1] https://github.com/hips/autograd [2] https://www.tensorflow.org/xla/operation_semantics