This looks really cool, and it's good to see Keras come full circle back to being an ergonomic interface with support for multiple frameworks. I remember being pretty disappointed when pluggable back ends went away. I appreciate that in the NLP module there is the most humane and concise LORA implementation I'm aware of. The ability to embed Keras components into models using other frameworks is pretty key.
Question: What's the model export story? If I want to export for CoreML or use the new PyTorch model compilation is there a straight forward way to do that?
So far the export story focuses on SavedModel and the services that consume that format, e.g. TFLite, TFjs and TFServing. You can just do `model.export(path)`, and you also have access to the `ExportArchive` class for fine-grained configuration.
We have not tried CoreML export yet.
PyTorch `.compile()` works with Keras models. It may not necessarily result in a speedup however.
We don't have a separate `ops.linalg` package, but we do include `numpy.linalg` ops as part of `keras.ops`. For now only 2 ops are supported: `qr` and `solve`. We're open to adding any `numpy.linalg` op that turns out to be useful (or you could open a PR for any op you need).
Hey Francois, congrats to you and the team on the launch! I've generally chosen Pytorch over Tensorflow for my day to day, but now that Keras is framework agnostic I'm excited to revisit it.
One thing I'm wondering about is if it's possible (or necessary?) to use Keras in concert with Pytorch Lightning. In some ways, Lightning evolved to be "Keras for Pytorch," so what is the path forward in a world where both exist as options for Pytorch users—do they interoperate or are they competitors/alternatives to each other?
Both Keras models/layers (with the PyTorch backend) and Lightning Modules are PyTorch Modules, so they should be able to interoperate with each other in a PyTorch workflow. We have not tried this with Lightning, but we've had a good experience with custom PyTorch Modules.
More broadly, it's feasible to use Keras components with any framework built on PyTorch or JAX in the sense that it's always possible to write "adapter layers" that wrap a Keras layer and make it usable by another framework, or the other way around. We have folks doing this to use Flax components (from JAX) as Keras layers, and inversely, to use Keras layers as Flax Modules.
We made sure that TFLite workflows would run smoothly with Keras 3 models. We did not come up with any TFLite related improvements. The focus was on the multi-backend architecture, distribution, and training performance.
Competition is always good. That said, Keras is a tough sell. I think the ML framework market, particularly for gen AI is moving either away from abstraction to lower level frameworks (ggml or custom, etc) or consolidating around HF. It would be cool to see Keras emerge as a meaningful HF transformers competitor, but I'm not sure what it would take to get there. As it is, I don't see a big incentive to use it, or for people getting started to learn it (especially to the exclusion of the underlying frameworks) which is too bad.
I disagree because the majority of data science roles focus on optimizing production processes or customer acquisition/retention. In practical terms, while we often reference tools like OpenAI, the real-world application revolves around machine learning-based data analytics and unstructured business intelligence. Keras emerges as a valuable tool for businesses due to its combination of machine learning capabilities beaing easy,allow data experimentation, for the business knowledge. In this context, the emphasis on machine learning isn't as pronounced as it is in companies dedicated solely to ML, such as OpenAI or Google ML
I have used both Keras and pytorch Lightning. They have a lot of similarities and I'm fine with both. That said the abstraction does not really cover the input processing part: ie. pytorch dataloader or tf.data part
I'm not in the field but as a techie this attempt to be a universal solvent, to play well with everyone, looks extremely smart & extremely sharp. This is a highly compelling sell for me, and greatly boosts the chance that when I do start to dabble, I'll look at Keras.
See also https://github.com/unifyai/ivy which I have not tried but seems along the lines of what you are describing, working with all the major frameworks
It also reads a bit like an official promotion for JAX (well-deserved btw) by mentioning its advantages separately and putting it first in the list of main frameworks.
It's an open secret that TensorFlow is a deprecated framework internally at Google, and present/future model development should be done on JAX. Since Keras is a Google-owned product, it makes sense.
Otherwise, if you want to reuse an existing LLM (or just see how a large one would be implemented in practice) you can check out the models from KerasNLP. For instance, this is BERT, basically just a stack of TransformerEncoders. https://github.com/keras-team/keras-nlp/blob/master/keras_nl...
I'm really excited about this! I know the Keras team has been hard at work and it's cool to see the 3.0 release as sort of a reborn framework. One thing I'm particularly stoked about is the ability to load models from other frameworks but then work with TF and Keras based exports for productionization, especially on e.g. edge. I think there's a lot of goodness beyond just being able to pick and run a pre-existing backend. Thanks for all the hard work!
You can absolutely serve with Keras if your inference server is in Python. For instance, if you're looking for a basic solution, you can just set up a Flask app that calls `predict()` on a Keras model.
If you're looking for a high-performance solution that is entirely Python-free, then you can simply export your Keras model as a TF SavedModel and serve it via TFServing. TFServing is C++ based and works on both CPU and GPU.
Mojo is a programming language, this is a library for Python that provides an abstraction over three Python-specific ML frameworks. Apples and oranges.
You could use Keras inside of Mojo since Mojo is Python-compatible/embeds a Python interpreter.
This means that the API, the abstractions, the workflows are battle-tested.
The codebase itself went through 2 months of private beta and 5 months of public beta. It is already used in production by several companies. It's not as battle tested as older frameworks, but it's fairly reliable.
I've been out of the ML game for a little while now (2+ years) but previously was under the impression everyone loved Keras. This thread says otherwise.
The only mentioned alternative so far is `ggml`, which I have heard mentions of but am not familiar with. What are other alternatives & their corresponding pros and cons? Now, I am familiar with:
Depends what kind of ML. If you were just spinning up models to shove data through, sure. If you wanted to craft a model to your particular needs, you will have a much better time with Torch, even 5 years ago when online tutorials were filled with TF/Keras.
I think Keras more or less died when the TF 2.0 transition was botched so badly. Many moved to Torch and never looked back.
FWIW I actually prefer JAX but my work is atypical compared to the usual "predict churn" or whatever application.
Keras started out great but grew clumsily, making custom use-cases cumbersome and error prone and also became inextricably linked with TensorFlow (which was a big headache compared with PyTorch).
It seems like this rewrite cleans up the meandering mess of Keras's middle period, or at least I'd be willing to give it a try.
It's been a few years since I did Keras dev full time, but debugging was a nightmare. PyTorch- as long as you don't compile and you run on CPU, it's pretty much like debugging standard code. Debugging CUDA is harder.
Edit: Seems like `run_eagerly` solves a lot of the pain of debugging Keras code.
Huggingface I would consider a high level framework, that uses pytorch as a backend (they may now be using rust/candle as well?)
Mojo is another ML specific python dialect.
I think most people including me associate Keras with being very simple and high level, which isn't really correct now based on the article.
ggml is somewhat specialized, I was giving it as an example of the kind of framework I think we'll see more of, that is specialized, dependency free, written in a compiled language and directly optimized for speed. As use cases consolidate around specific architecture like LLMs, a faster and simpler low lever framework becomes preferable to a swiss army knife with abstraction upon abstraction like pytorch.
My guess; perspective from a noob who's been using TF (Which I think absorbed Keras's API??) and OpenVINO: The Data Science/Python crew prefer PyTorch, and it's become self-perpetuating by WOM. So, people new are being recommended to use Torch, and it spreads that way.
One day, I set off to create an ML project in Tensorflow; but I soon realized that getting the data in ready would be a huge challenge and also a massive value-add. It's been three years and I'm still working on the data!
Well... some 4 years ago I got a non trivial time series forecasting tool into production, built on Keras. The experience was pretty good, there was nothing that annoyed me too much.
However, as the comments here show, the mindshare and community momentum seems to have shifted totally to Torch.
Especially considering that it's transformers everywhere, right now, and there's just so much premade stuff built on top of pytorch, I'd probably stick with that. At least out of pragmatism such as the ease of hiring people with torch experience.
The transparent Numpy experience seems nice, keras was the first thing I ever built real NNs with, all said it's never been bad to me but... to conclude, no.
According to PyPI downloads and user surveys (like the yearly StackOverflow survey) the two main frameworks are TensorFlow and PyTorch for Deep Learning, and Scikit-Learn for classical ML.
Every time some survey pops up, TF somehow looks still relevant while I know noone who uses it or even considers using it unless they are new to DL field. How much of TF here is v2.0?:)
We use exclusively PyTorch at work both for CV and NLP tasks and this is the standard nowadays. Keras was cool 5 years ago (last time I checked it) but it somewhat quickly faded due to TF.
PyTorch has the nicest debugging experience. JAX is supposed to be powerful too, but I'm skeptical of its static graph which is what made TensorFlow such a chore. I'm whishful about Mojo, in theory it sounds great.
On the contrary, that's why I find Keras 3 interesting (although I don't see myself switching anytime soon). It supports both PyTorch and JAX, and Keras Core models/layers can be used interchangeably with PyTorch modules: https://twitter.com/fchollet/status/1697020631752298982
I've only experienced him polite and responsive. That said, maintaining Keras must have been an unhealthy amount of work for one person, and I think OSS developers in that situation deserve the benefit of doubt that being brusque or ignoring issues is not a character flaw, but a defense mechanism to keep their sanity.
We disagree. I was in the throws of a life threatening illness and working on Keras in the very early days was an outlet for me. During that time the main author accused me publicly of trying to sabotage the project; a comment completely out of left field.
To clarify, I have never attacked PyTorch, on Twitter or otherwise.
What happened is that I was a target of online harassment campaign from 2017 to January 2021 (when it stopped abruptly), which originated from a PyTorch developer and took the form of frequent anonymous emails (or messages on social networks) with insults and threats. The thread you link to below is me complaining about the harassment campaign and calling for civility.
Some frameworks fans can be extremely toxic, e.g. creating anonymous accounts on HN for the purpose of bashing one framework or one person.
Are you referring to Chollet? He does come off as arrogant at times.
I had some hopes when Keras dropped the other backends and just became part of TensorFlow 2.0, for which I had high hopes too, but I think it just made it worse. I've lost all interest, and getting increasingly disillusioned by TensorFlow for each day.
I encourage you to reread the Twitter posts in question, your post here, and evaluate, as if you were a disinterested third party, if it still makes sense.
The context and request for civility makes sense and makes it look less like and attack in context. Implying that it's some characteristic of pytorch users is a bit more damning. Trolls are out there, I don't think it's using a particular deep learning framework that makes them more trollish, implying otherwise isn't constructive.
Question: What's the model export story? If I want to export for CoreML or use the new PyTorch model compilation is there a straight forward way to do that?