Keras 3.0
keras.io
keras.io
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.
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?
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.
Cross-platform differences between the behavior of tf.linalg and torch.linalg have cost me a lot of time over the years.
You can use this migration guide to identify and fix each of these issues (and further, making your code run on JAX or PyTorch): https://keras.io/guides/migrating_to_keras_3/
Were any improvements made?
I hugely rely on TFLite for a bunch of hobby projects.
> A full implementation of the NumPy API. Not something "NumPy-like" — just literally the NumPy API, with the same functions and the same arguments.
I suppose it's like https://cupy.dev/
What is HF? Is it HF as in RLHF?
Stupid question - can this also be used for composing transformer based LLMs?
[0]. https://keras.io/getting_started/intro_to_keras_for_engineer...
There are some tutorials about how to do it "from scratch", like this: https://keras.io/examples/nlp/neural_machine_translation_wit...
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...
Am wondering how well this will work on Windows.
Likewise for the pretrained models on my personal laptop (i7, 32GB RAM, RTX 2060 6GB).
Train with keras and then?
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.
You could use Keras inside of Mojo since Mojo is Python-compatible/embeds a Python interpreter.
In case of a full rewrite how can we talk about battle-tested? I can understand the API is, but not the implementation.
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.
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:
- Tensorflow (complex API right?)
- Keras (simple API?)
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.
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.
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.
Edit: Seems like `run_eagerly` solves a lot of the pain of debugging Keras code.
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!
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.
See: https://survey.stackoverflow.co/2023/#technology
* TensorFlow: 9.53% usage among all devs
* Scikit Learn: 9.43%
* PyTorch: 8.75%