Keras and PyTorch! I thought I'd never see the day! Glad to see the two communities bury the hatchet.
I don’t get it - why would you want Keras if you already use Pytorch?
Keras Core: Keras for TensorFlow, Jax, and PyTorch
31–40 of 73 posts
Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch
#32Earlier quoted context omitted.
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.
https://pytorch.org/docs/stable/generated/torch.nn.Sequentia...
Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch
#33Earlier quoted context omitted.
Keras has a cleaner API compared to base PyTorch, especially if you want to use the Sequential construction as demoed in the post.
How so? You can use torch.nn.Sequential pretty much equivalently? https://pytorch.org/docs/stable/generated/torch.nn.Sequentia...
The point about the better API overall still stands (notably including the actual training part, as base PyTorch requires you to implement your own loop)
Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch
#34Keras and PyTorch! I thought I'd never see the day! Glad to see the two communities bury the hatchet.
I don’t get it - why would you want Keras if you already use Pytorch?
Keras is a higher-level API. It means that you can prototype architectures quickly and you don't have to write a training loop. It's also really easy to extend.
I currently use PyTorch Lightning to avoid having to write tonnes of boilerplate code, but I've been looking for a way to leave it for ages as I'm not a huge fan of the direction of the product. Keras seems like it might be the answer for me.
Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch
#35Earlier quoted context omitted.
I don’t get it - why would you want Keras if you already use Pytorch?
Because sometimes you don’t want to write your own training loops, you just want a working method to train a model.
Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch
#36Earlier quoted context omitted.
I don’t get it - why would you want Keras if you already use Pytorch?
The same reason why you might want to use Keras if you use any of the other backends. They operate at different levels. Keras is a higher-level API. It means that you can prototype architectures quickly and you don't have to write a training loop. It's also really easy to extend. I currently use PyTorch Lightning to avoid having to write tonnes of boilerplate code, but I've been looking for a way to leave it for ages…
Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch
#37If I want to use this brave new keras with torch.compile, what does that look like?
Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch
#38Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch
#39I worked on the project, happy to answer any questions!
Hi, first off thank you for your contributions, and this goes to the entire team. Keras is a wonderful tool and this was definitely the right move to do. No other package nails the “progressive disclosure” philosophy like Keras. This caught my eye: > “Right now, we use tf.nest (a Python data structure processing utility) extensively across the codebase, which requires the TensorFlow package. In the near future, we in…
If you want to make a model with a custom train_step that is cross-backend, you can do something like:
def train_step(self, *args, *kwargs):
if keras.config.backend() == "tensorflow":
return self._tf_train_step(*args, *kwargs)
elif ...
BTW it looks the previous account is being rate-limited to less than 1 post / hour (maybe even locked for the day) so I will be very slow to answer questions.Re: Keras Core: Keras for TensorFlow, Jax, and PyTorch
#40Earlier quoted context omitted.
The same reason why you might want to use Keras if you use any of the other backends. They operate at different levels. Keras is a higher-level API. It means that you can prototype architectures quickly and you don't have to write a training loop. It's also really easy to extend. I currently use PyTorch Lightning to avoid having to write tonnes of boilerplate code, but I've been looking for a way to leave it for ages…
What’s so hard about writing a training loop?