Live data from Hacker News

Keras Core: Keras for TensorFlow, Jax, and PyTorch

keras.io

11–20 of 73 posts

Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch

#11
post #4

Keras was already that some years ago. It supported tensorflow, theano, mxnet if my memory is right. And then they ditched everything for tensorflow. At the time it was really hard to use keras without calling backend directly for lots of optimisation, unsupported feature on they API etc... This make the use of Keras not agnostic at all. What's different now ?

> What's different now ? PyTorch adoption: back when Keras went hard into TensorFlow in 2018, both TF and PyTorch adoption were about the same with TF having a bit more popularity. Now, most of the papers and models released are PyTorch-first.

Yes I understand why they do the move (they want to attract pytorch user). What's the benefit for the user instead of directly using pytorch for example ? I see we can maybe use tpu by switching to jax etc...

PS: sorry I'm a bit salty by my user experience of Keras.

Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch

#13
post #9

I worked on the project, happy to answer any questions!

This looks awesome; I was a big fan of Keras back when it had pluggable backends and a much cleaner API than Tensorflow. Fast forward to now, and my biggest pain point is that all the new models are released on PyTorch, but the PyTorch serving story is still far behind TF Serving. Can this help convert a PyTorch model into a servable SavedModel?

For a Keras Core model to be usable with the TF Serving ecosystem, it must be implemented either via Keras APIs (Keras layers and Keras ops) or via TF APIs.

To use pretrained models, you can take a look at KerasCV and KerasNLP, they have all the classics, like BERT, T5, OPT, Whisper, StableDiffusion, EfficientNet, YOLOv8, etc. They're adding new models regularly.

Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch

#14

Does this mean the weights output can be backend agnostic? Also, are there any examples using this for the coral TPU?

Yes, model weights saved with Keras Core are backend-agnostic. You can train a model in one backend and reload it in another. Coral TPU could be used with Keras Core, but via the TensorFlow backend only.

Super cool, does that mean if someone trains something using the PyTorch backend, I can still use it with the coral if I load the weights using the tensorflow backend?

Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch

#15

Does this mean the weights output can be backend agnostic? Also, are there any examples using this for the coral TPU?

Yes, model weights saved with Keras Core are backend-agnostic. You can train a model in one backend and reload it in another. Coral TPU could be used with Keras Core, but via the TensorFlow backend only.

[deleted]

Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch

#17
post #11

Earlier quoted context omitted.

> What's different now ? PyTorch adoption: back when Keras went hard into TensorFlow in 2018, both TF and PyTorch adoption were about the same with TF having a bit more popularity. Now, most of the papers and models released are PyTorch-first.

Yes I understand why they do the move (they want to attract pytorch user). What's the benefit for the user instead of directly using pytorch for example ? I see we can maybe use tpu by switching to jax etc... PS: sorry I'm a bit salty by my user experience of Keras.

Keras has a cleaner API compared to base PyTorch, especially if you want to use the Sequential construction as demoed in the post.

Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch

#19

I worked on the project, happy to answer any questions!

Congrats on the launch! I learned Keras back when I first got in to ML, so really happy to see it making a comeback. Are there some example architectures available/planned that are somewhat complex, and not just a couple layers (BERT, ResNet, etc.)?

Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch

#20

I worked on the project, happy to answer any questions!

Congrats on the launch! I learned Keras back when I first got in to ML, so really happy to see it making a comeback. Are there some example architectures available/planned that are somewhat complex, and not just a couple layers (BERT, ResNet, etc.)?

Yes, you can check out KerasCV and KerasNLP which host pretrained models like ResNet, BERT, and many more. They run on all backends as of the latest releases (today), and converting them to be backend-agnostic was pretty smooth! It took a couple of weeks to convert the whole packages.

https://github.com/keras-team/keras-nlp/tree/master/keras_nl... https://github.com/keras-team/keras-cv/tree/master/keras_cv/...

Post reply on HN