News for hackers. Stuff that matters.
Re:Taking ML to production with Rust by sandGorgon on Monday December 02, 2019 @07:23AM (#21681773)
Although I am a python guy, if I had to bet on an alternative language here - its going to be Swift.

The amount of evangelism money that Google is spending on Tensorflow is staggering. Its not just t-shirts, but an entire ecosystem - TensorBoard.dev, Tensorflow Privacy, TF Enterprise, Explainable AI Beta, free TPU on Google Colab etc.

And all of them will soon be backed using Tensorflow Swift (https://www.tensorflow.org/swift). This is MNIST for Swift Tensorflow - https://github.com/tensorflow/swift-models/blob/master/Datas... . Mind you this is runnable on Google Colab using TPU hardware acceleration in swift.

Swift vs Rust is a very political thing...but previous discussions on HN have been tilted in favor of Swift [1]

And we havent even touched on the elephant in the Room - Swift may soon hook into OSX Metal (which is arguably the only way to do GPU AI on macbooks now that the nvidia-Apple CUDA divorce is official [2] ). You can already call Metal from Swift...but not write shaders directly IMHO.

[1] https://cloud.google.com/explainable-ai/

[2] https://gizmodo.com/apple-and-nvidia-are-over-1840015246

Re:Taking ML to production with Rust by Abishek_Muthian on Monday December 02, 2019 @12:50PM (#21684772)
>And we havent even touched on the elephant in the Room - Swift may soon hook into OSX Metal

Not sure whether I understood your statement correctly, but you can use Swift for using metal API already. Swift is not the bottleneck for TensorFlow, PyTorch like open-source machine learning library appearing for macOS based on metal, it is the closed nature of mac ecosystem itself.

Look at the flak Google, Facebook get regarding these projects in-spite of them being open-source. If an equivalent metal (only) based open-source machine learning of this scale did pop up with Apple's help; it may not go well with the ML/DL community as sharing & collaboration is valued high here. Apple has even started to publishing open ML papers to attract talent.

Then again, Apple doesn't get as much scrutiny as Google/Facebook does with the tech community, take a look at any HN thread on GoLang/Swift; the discussion on the former goes to the company rather than the programming language as in the case of latter in-spite of both being open-source.

Re:Taking ML to production with Rust by sandGorgon on Monday December 02, 2019 @11:35PM (#21689952)
I'm aware that you can hook into metal using swift already. I meant the shader language (which is a variant of c++), though there are issues and proposals to make it swift centric.
Re:Taking ML to production with Rust by mark_l_watson on Monday December 02, 2019 @08:03AM (#21681980)
When first announced, I was very upbeat on S4TF and the XCode and Swift drops with TF and some examples more or less worked and were interesting.

Since the first early release, which largely worked for me, subsequent releases have generally not worked for me. I even had much more trouble with S4TF than, for example, the Haskell TF bindings that always take a bit of setup since I don’t use the provided docker setup.

A little off topic, but, the Julia Flux ML library is worth looking at if you wanna “turtles all the way down” setup.

Re:Taking ML to production with Rust by rob74 on Monday December 02, 2019 @08:32AM (#21682131)
While Swift may be the "latest and greatest" language with official support, if you look at https://www.tensorflow.org/api_docs, it's only one of several (the others being C++, Java, JS, Go and of course Python). Plus, there are community-supported bindings for C#, Haskell, Julia, Ruby, Rust and Scala). Just to make the picture complete...
Re:Taking ML to production with Rust by throwlaplace on Monday December 02, 2019 @08:58AM (#21682294)
Swift for tensor flow aren't bindings - it's a ground up rearchitecting of tensorflow
Re:Taking ML to production with Rust by pjmlp on Monday December 02, 2019 @10:01AM (#21682894)
For Mac OS only apparently.
Re:Taking ML to production with Rust by throwlaplace on Monday December 02, 2019 @10:30AM (#21683193)
Re:Taking ML to production with Rust by pjmlp on Monday December 02, 2019 @10:37AM (#21683265)
Having a package available for a specific OS doesn't mean it is usable, specially when it still requires conditional compilation to import either Darwin or Glibc, instead of Foundation.

And I don't see any Windows there.

Then there is the whole set of libraries that only compile on Apple platforms, no IDE, no Playgrounds and so on.

Re:Taking ML to production with Rust by ynx on Tuesday December 03, 2019 @01:20AM (#21690384)
> it still requires conditional compilation to import either Darwin or Glibc, instead of Foundation

Well, swift-corelibs-foundation has made a lot of progress, and strictly speaking, to a certain point you don't actually want to hide some of the implementation details from the developer. This isn't Java - natively calling out to C is a thing that Swift can and will do.

> I don't see any Windows there.

Look harder. Swift for Windows: https://github.com/compnerd/windows-swift

> no Playgrounds

Swift Playgrounds: https://github.com/save-buffer/swift-repl

> no IDE

official VSCode work: https://github.com/apple/sourcekit-lsp/ + https://github.com/apple/sourcekit-lsp/tree/master/Editors/v...

> and so on

Do tell. What other concerns do you have? You seem deeply misinformed. While Swift may not yet have an ecosystem outside of Apple, it is factually incorrect to say that it is not usable outside of it.

Re:Taking ML to production with Rust by throwlaplace on Monday December 02, 2019 @11:20AM (#21683803)
>specially when it still requires conditional compilation to import either Darwin or Glibc, instead of Foundation.

you don't need to compile from source - binaries are distributed (if you actually read my link instead of assuming it was just github source you would see that).

>And I don't see any Windows there.

yes they're aware of this and it's being worked on

>Then there is the whole set of libraries that only compile on Apple platforms, no IDE, no Playgrounds and so on.

you're moving goal posts in order to be able to have an axe to grind.

your comment was

>For Mac OS only apparently.

the fact that there's a runtime that runs on linux shows that that was incorrect.

>set of libraries that only compile on Apple platforms

i don't know what you're talking about here - s4tf libraries compile on all platforms e.g. https://github.com/eaplatanios/swift-rl

>no IDE, no Playgrounds and so on.

i don't see how xcode being developed by apple (not the s4tf team) has anything to do with whether s4tf is multiplatform.

Re:Taking ML to production with Rust by pjmlp on Monday December 02, 2019 @11:52AM (#21684158)
Not moving goalposts at all.

Swift is only usable in Apple OSes.

Making a tiny subject of its ecosystem available outside of Apple platform doesn't make it usable for something that pretends to replace Python ecosystem on data science.

Re:Taking ML to production with Rust by cwyers on Monday December 02, 2019 @02:20PM (#21685805)
And R has Tensorflow bindings too. https://tensorflow.rstudio.com/
Re:Taking ML to production with Rust by pjmlp on Monday December 02, 2019 @10:01AM (#21682889)
Microsoft also provides Tensorflow bindinds via ML.NET.

So any language that can target .NET is also able to plug into it, and I certainly would pick F# over Swift.

Re:Taking ML to production with Rust by rvz on Monday December 02, 2019 @05:00PM (#21687503)
> Microsoft also provides Tensorflow bindinds via ML.NET.

Well Swift for Tensorflow is more than just a binding to begin with. The difference in maintenance is that Google officially supports Swift whereas Microsoft would be always catching up to keep theirs updated.

> So any language that can target .NET is also able to plug into it, and I certainly would pick F# over Swift.

I can use both Swift for my iOS app (inferencing), training is also possible thanks to Python interoperability (@dynamicCallable), soon to be replaced by native C++ interoperability.

If I chose F#, as much as you may think it is a good choice unless your stack/team is using Microsoft technologies, I see this as a potential sunken cost here and I certainly wouldn't use it for this case and would rather rely on the active maintenance of the Swift/Tensorflow team at Google to improve this rather than using another great language for an unsupported use case.

Re:Taking ML to production with Rust by pjmlp on Monday December 02, 2019 @05:13PM (#21687620)
The big difference being that I can use ML.NET on macOS, Linux, Windows, with Tensorflow lite on the roadmap. Whereas Swift, pretty much is Apple only.

Even your examples are a proof of that.

Zero persons from Swift/Tensorflow team at Google are working on improving Linux/Windows support.

Linux was been mostly volunteer and some IBM contributions.

Windows are just volunteers, and have restarted the port multiple times.

Re:Taking ML to production with Rust by ComputerGuru on Monday December 02, 2019 @01:48PM (#21685432)
I don’t know why you are painting this as Swift vs Rust when they are apples to oranges. Why so defensive? They’re drastically different languages operating at different abstraction levels with different (though overlapping) use cases, with different motivations and design goals.
Re:Taking ML to production with Rust by k__ on Monday December 02, 2019 @07:42AM (#21681858)
I had the feeling Swift was much higher level than Rust and it also didn't bring much new to the table.
Re:Taking ML to production with Rust by hellofunk on Monday December 02, 2019 @01:55PM (#21685519)
I think the OP is making that point that Python was successful because of how relatively simple and high-level it is, thus Swift has potential in that area for the same reason. Rust is hardly approachable by "the masses", certainly all the ML-first engineers who are not as hard-core on the programming mindshare, hence why Python became king.
Re:Taking ML to production with Rust by hnaccy on Monday December 02, 2019 @11:45AM (#21684092)
Everything about TF on Swift says zombie project.

I'll be amazed if it ever gets any significant foothold in the ML world.

Re:Taking ML to production with Rust by Roritharr on Monday December 02, 2019 @07:41AM (#21681853)
This is really new to me, I always thought of Swift as the iOS thing to look into when doing something there.

Very interesting that Google is pushing Swift for their Tensorflow Platform. Any ideas why Swift is of interest for Google?

Re:Taking ML to production with Rust by Abishek_Muthian on Monday December 02, 2019 @10:17AM (#21683059)
You can read why Tensorflow team chose Swift here[1].

[1]https://github.com/tensorflow/swift/blob/master/docs/WhySwif...

Re:Taking ML to production with Rust by bpicolo on Monday December 02, 2019 @09:18AM (#21682477)
Swift playgrounds seem very much aligned with notebook style ML development. They're in many ways a much more powerful version of notebooks.

https://www.apple.com/swift/playgrounds/

Re:Taking ML to production with Rust by jorgemf on Monday December 02, 2019 @07:51AM (#21681914)
They hired one of the Swift leaders for the tensor flow team
Re:Taking ML to production with Rust by jorgemf on Monday December 02, 2019 @07:52AM (#21681923)
I whish it was kotlin instead of Swift. But as much as I want to move away from python, there are reasons to stick with it (ML libraries and low entry barrier for non programers)
Re:Taking ML to production with Rust by hellofunk on Monday December 02, 2019 @01:51PM (#21685469)
Swift for writing Metal shaders? That's the first I've heard of this, and honestly I find that doubtful but what do I know.
Re:Taking ML to production with Rust by throwlaplace on Monday December 02, 2019 @07:43AM (#21681868)
>And all of them will soon be backed using Tensorflow Swift

Lol at this. It's ~5 years before S4TF has feature parity with TF let alone pytorch. I watch their design meetings almost every Friday (they're public) and not only is the core autodiff runtime nowhere near 1.0 (just a couple of weeks ago they were talking about replacing their bespoke system with XLA) there's almost no differentiable function type library (nn.functional). Not to mention ecosystem (there are probably, at most, 20 people, including the S4TF team, consistently using S4TF). This is not to say that they're not doing great work but that's it's far off.

Edit: I forgot to also say they're going through the Swift evolution process (since they're building the autodiff into the Swift compiler) and it's completely unknown whether it'll be accepted. I have no idea what will happen to the project if it doesn't but if they end up having to maintain their own Swift runtime then S4TF is dead in the water because no one will be comfortable deploying two runtimes and even then no one will trust Google to maintain.

Re:Taking ML to production with Rust by asparagui on Monday December 02, 2019 @11:38PM (#21689962)
As one of those 20 people, I feel like I'm in good company!

Five years is pessimistic. The core library is still in a state of flux, but the team is getting the fundamentals hammered out. Once the foundation is in place, adding higher level apis should be relatively straightforward.

Re: XLA/MLIR, s4tf is actively trying to coordinate with other groups within google. Whatever short term losses there are in time/energy will be paid off down the road when the project can piggyback off other people's progress.

Finally, while the swift evolution process isn't going as quickly as would be desired, the changes needed to merge the tensorflow branch have been identified and are being worked on. It's just a matter of time till the two projects are in sync.

Re:Taking ML to production with Rust by sandGorgon on Tuesday December 03, 2019 @01:12AM (#21690354)
Thank you for your work. Although I still wish you guys had done Kotlin instead of Swift.

I haven't seen people love a language without evangelism like Kotlin. And you already had the world's biggest ecosystem (because of Android).

And Kotlin native is pretty good. i daresay you would have had better control of the compiler there.

Re:Taking ML to production with Rust by justicezyx on Monday December 02, 2019 @11:32PM (#21689941)
How can I audit the Friday design meeting?
Re:Taking ML to production with Rust by asparagui on Monday December 02, 2019 @11:38PM (#21689971)
Re:Taking ML to production with Rust by eeZah7Ux on Monday December 02, 2019 @08:35AM (#21682147)
> The amount of evangelism money that Google is spending

Same for Rust, Swift, Go... it's like we are in another bubble like the dot-com and everything is hype driven.

Re:Taking ML to production with Rust by kibwen on Monday December 02, 2019 @12:50PM (#21684784)
Although I am not on the Rust team and do not speak for them, I have enough familiarity Rust's funding situation to assure you that there is no budget available for developer evangelism. :P
Re:Taking ML to production with Rust by microcolonel on Monday December 02, 2019 @09:18AM (#21682479)
Well... not everything, Rust is actually good. Just sit back enjoy the effects of the investment in this stuff, and don't worry about other people being foolish with their money.
Re:Taking ML to production with Rust by zozbot234 on Monday December 02, 2019 @09:24AM (#21682533)
Even Go is not that bad tbh. It's basically Java/.NET done right, and that makes it quite appropriate for some uses.
Re:Taking ML to production with Rust by pjmlp on Monday December 02, 2019 @10:06AM (#21682948)
Not it is not.

The only thing that is has done right versus Java is having AOT compilation since the begining (.NET always supported it via NGEN).

Not to mention that Java and .NET are platforms for programming languages, and already there Go loses big time versus what we have available on our toolbox.

Re:Taking ML to production with Rust by saberience on Monday December 02, 2019 @11:16AM (#21683764)
.NET done right? haha really? I find Go to be an order of magnitude less productive than C# and more complicated to get up and running with actually building useful things. Go over-complicates things which C# and .NET make easy while also having less readable code and less robust tooling.
Re:Taking ML to production with Rust by pas on Monday December 02, 2019 @09:50AM (#21682763)
I still have no idea how to get/run/make/compile/deploy Go stuff. Sure, there's some GOPATH, some packages, dep? go get?

I have no idea how, but 1-2 years ago when Kubernetes was new I tried it, and somehow got it to build (obviously I must have been using the stuff from the README) - but I haven't learned it.

Whereas with Rust? It's cargo. Done. That's up. Or rustup if you don't have anything yet. With Java? It's IntelliJ or the OpenJDK.

Re:Taking ML to production with Rust by hellofunk on Monday December 02, 2019 @02:19PM (#21685789)
Yeah, vendoring in Go can be a bit frustrating. One of the great benefits of the JVM is how dependencies are isolated to the project so nicely, bundled into the jar, and everything "just works" no matter where you take that jar. That's one of the most liberating aspects of working with Java/Kotlin/Clojure, etc.
Re:Taking ML to production with Rust by jeremyfranco on Monday December 02, 2019 @10:07AM (#21682955)
Re:Taking ML to production with Rust by pas on Monday December 02, 2019 @06:23PM (#21688221)
I haven't encountered it so far.

Last time I fiddled with something Go based was wit cfssl (cloudflare's excellent PKI thingie), and that uses something else. I don't remember what, it's in the GitHub Action YML file now. (Which alas turned out to be a big hot air pipeline :// )

I plan on learning a bit more about Go, but last time with the 2.0 proposal and the go mod/dep thing it seemed like there will be some streamlining, so I decided to postpone the immersion into the Go-cean.

Re:Taking ML to production with Rust by shpongled on Monday December 02, 2019 @01:21PM (#21685127)
Yeah, every time I have tried to get a Go project set up or built from source I end up throwing in the towel 15 minutes later in frustration. Never had that kind of experience with any other language
Re:Taking ML to production with Rust by The_rationalist on Monday December 02, 2019 @10:19AM (#21683081)
It's not obvious to everyone yet but the modern language that will become the most mainstream is obviously Kotlin. It has almost all modern language features, a ton of justified syntax sugars, and is 100% compatible with the Java ecosystem making it the most production ready among "modern languages"

The only other language with such a property is to my knowledge, typescript.