At first I was fairly disappointed that Swift was chosen over Julia, and I still wish there was strong Julia support because Julia is a great language, but I've slowly been changing my mind and think Swift could be a really good choice long term.
I also just really like Chris' work and trust him to make the right calls until proven otherwise.
I love julia, but it already has a TF library that does a lot of very nice things (like not having to specify a computational graph separately from the execution) and there are other really interesting machine learning libraries (like knet).
Swift is a good choice because there are some reasonably good mobile targets, which Julia does not have. If you're deploying a ML model, you should use swift. If you're developing one, you should use julia.
As a longtime fan of C#, this article and use case just pushed me from “why would anyone think they needed to invent Swift” to “wow that’s an extremely cool set of language design constraints!”
Given the fact that the vast majority of people is still on Windows, using Swift (with zero official support for Windows) will artificially limit the use of the project outside the circle of the original developers.
That being said, you can use Swift through WSL, but not directly on Windows.
> That being said, you can use Swift through WSL, but not directly on Windows.
I thought so too, but i've checked the instructions to build on windows, and now there's a way to build it natively using Visual Studio cl(or clang-cl).
Following the instructions here, it worked for me.
Does Swift have a large community beyond iOS apps? Last I used it was years ago, right after it was introduced by Apple. I'm curious if it has found growth in other areas.
Not really atm. There is a small community around server-side-swift which did some impressive work so far, most interesting project is IMO the Vapor Framework [1], but at least outside the Apple Dev community they didn’t get much attention so far.
For general system programming, which would be also possible with swift, Rust seems currently a lot more popular.
I've seen a few server-side Swift frameworks (for building web apps or API apps) such as Perfect[1] and Kitura[2] (which is backed by IBM). It's not clear to me how much uptake they have so far.
Still a bit more verbose than Python. What would you gain by doing the same in Swift actually? If you have to type more code to do some experiments, and still have to import Python libraries for extra functions as they do in that example, what's the selling point? (beside it being cool)
Some benefits vs Python are static types (catching more errors at compile-time vs hours into a training run), no GIL, don't have to drop to C++ for higher performance.
Some benefits vs some other (non-Python) languages are a shallow learning curve, small boilerplate, safety-by-default, and a growing community.
Obviously there are places where Python and others have advantages over Swift too, and several of those are called out in the paper.
I think the primary advantage of using this is that you get both the usability of writing imperative code (like PyTorch or TF Eager) and the benefits of having a computation graph (easier distributed training, using TPUs and stuff).
But no GIL is the most important part. Multithreaded preprocessing data input to the network is almost a must these days, but that is hard to achieve in Python. Multiprocessing or that PyTorch magic alleviates the problem, but they are not as high performant as multithreading.
[+] [-] sandGorgon|7 years ago|reply
You can use numpy from swift..As well as load pickle files !
https://github.com/tensorflow/swift/blob/master/docs/DesignO...
[+] [-] __erik|7 years ago|reply
I also just really like Chris' work and trust him to make the right calls until proven otherwise.
[+] [-] dnautics|7 years ago|reply
Swift is a good choice because there are some reasonably good mobile targets, which Julia does not have. If you're deploying a ML model, you should use swift. If you're developing one, you should use julia.
[+] [-] yodon|7 years ago|reply
[+] [-] gok|7 years ago|reply
Super cool to see this implemented at the language level like this.
[+] [-] AlexeyBrin|7 years ago|reply
That being said, you can use Swift through WSL, but not directly on Windows.
[+] [-] oscargrouch|7 years ago|reply
I thought so too, but i've checked the instructions to build on windows, and now there's a way to build it natively using Visual Studio cl(or clang-cl).
Following the instructions here, it worked for me.
https://github.com/apple/swift/blob/master/docs/WindowsBuild...
[+] [-] waleedka|7 years ago|reply
[+] [-] stiGGG|7 years ago|reply
[1]: https://vapor.codes
[+] [-] johnymontana|7 years ago|reply
[1] https://perfect.org/
[2] https://www.kitura.io/
[+] [-] woolvalley|7 years ago|reply
And if your making a backend, why not use kotlin which is fairly similar, but you get the entire java ecosystem?
[+] [-] bitL|7 years ago|reply
[+] [-] favorited|7 years ago|reply
Some benefits vs Python are static types (catching more errors at compile-time vs hours into a training run), no GIL, don't have to drop to C++ for higher performance.
Some benefits vs some other (non-Python) languages are a shallow learning curve, small boilerplate, safety-by-default, and a growing community.
Obviously there are places where Python and others have advantages over Swift too, and several of those are called out in the paper.
[+] [-] glass_of_water|7 years ago|reply
[+] [-] netheril96|7 years ago|reply
But no GIL is the most important part. Multithreaded preprocessing data input to the network is almost a must these days, but that is hard to achieve in Python. Multiprocessing or that PyTorch magic alleviates the problem, but they are not as high performant as multithreading.
[+] [-] Froyoh|7 years ago|reply
[+] [-] ScottBurson|7 years ago|reply