It is not possible yet, but the team has been discussing ways to unblock such use cases. That said, since ffmpeg is a C library, you can import it directly to Swift. People have also written wrappers for it in native Swift: GitHub - sunlubo/SwiftFFmpeg: A Swift wrapper for the FFmpeg API.
Is there any plan/is it possible to build Tensor shapes into the Swift type system?
What would be the best way to contribute to the S4TF ecosystem as someone who’s now using Swift for the first time?
I’m really excited about this direction and would love to help, but don’t know how.
Great to know, thanks! I’ll keep an eye out.
(As an aside, I found that library and tried loading it in my NB, but it didn’t build. I didn’t try at all to fix it, though. No big deal at the moment.)
Should makeLayer
return something or does it mutate the model in place? I guess that Swift doesn’t support implicit return, right? Or am I missing something?
makeLayer
just returns a model that is a Layer
.
Wonderful! Couple quick thoughts:
- Try out Swift for TensorFlow and tell us (and the world) how it worked for you. Write blog posts & tutorials, and share them on the
swift@tensorflow.org
mailing list! If you get a good model implemented, send us a PR to add it to our swift-models repository. - If you’d like to take it to the next level, you can check out our Google Summer of Code ideas for projects & libraries, or as Jeremy suggested, convert more of the fast.ai library into Swift.
- If you want to jump right into the core, check out our bugs on bugs.swift.org and feel free to reach out on the mailing list for good ideas!
Shape safety is definitely super important to us, and we think that a lot of common errors can be avoided when we achieve compile-time shape checking and named dimensions. However, building shape information into Swift’s generics system may have a lot of theoretical and syntactic complexity, and Swift is not a dependently typed language. We plan to look into developing flexible static analyses that can ensure shape safety to some level without sacrificing usability.
Is it just me or is it totally incredible that this got put together in only a few weeks? Just unreal.
What is your best guess for why this first version of the fastai resnet in swift uses twice the memory of the pytorch version?
what about memory management and garbage collection?
from s4tf newsletter:
Starter bugs
Looking to contribute to the project? Have a look at the currently open tickets for starters:
- TF-448: Improve Tensor type documentation…
- TF-447: Improve TensorShape printing.
- TF-416: Produce error upon second usage of
PythonLibrary.useVersion
. - TF-130: Add API to serialize a
@convention
(tensorflow) function as a graph. - TF-67: BumpPtrAllocating some classes that have SmallBitVector fields.
edit:
thanks to @dan-zheng the more complete list of starter bugs is here:
That’s a great question!
Swift for TensorFlow is open-source and there are many ways to contribute.
- Visit the #harebrain category to see what other people are working on: notebooks, improving
swift-jupyter
, etc. - If you’re interested in deep learning APIs, check out the
tensorflow/swift-apis
repository. There’s a ton of open-source activity - recently contributors have helped add a ton of layers (which shipped in our v0.3 release)! - Check out our tutorials to get familiar with the system (writing models, custom differentiation, etc).
We also have a list of compiler-related starter bugs here.
Swift for TensorFlow builds on top of the existing C++ TensorFlow core. This core is optimized for large-batch runtime performance, and by default consumes all the memory on the GPU (and does its own memory allocation within a large arena).
What is an IDE you’d recommend for building Swift on Linux or Windows?
What is the timeline for differentiable control flow support?
As a college student, I just wanted to leave this here:
Thank you Chris and Jeremy for the best co-taught lecture I’ve ever attended
So we’ve discussed here there’s some existing web frameworks for Swift like Vapor, obviously you can develop iOS apps in Swift, what about Android apps? How could you deploy Swift models on Android?
We are working on it right now and it’s coming! Expect to see it in May.
Swift doesn’t use garbage collection, but instead uses automatic (atomic) reference counting. As a result, no need to new
or delete
. Memory management is automatic, but also deterministic and and doesn’t have GC-pauses. (Swift’s point in the automatic-memory-management design space is actually especially interesting given a future with accelerator hardware…)