Skip to main content

Keras 3: Train JAX Models with model.fit, Keras Hub, and Keras Recommenders

Google for DevelopersMay 21, 202519 min1,660 views
37 connections·40 entities in this video→

Keras Ecosystem and JAX Integration

  • πŸ’‘ The Keras ecosystem provides multiple entry points for using JAX, from simple model.fit loops to advanced model parallel distribution.
  • πŸ› οΈ Keras offers a comprehensive toolbox for deep learning, including model.compile, model.fit, and model.summary for building and training JAX models.
  • βœ… Keras supports various optimizers, losses, metrics, and callbacks, all compatible with the model.fit training loop abstraction.

Advanced Training with Keras

  • πŸš€ Keras follows the principle of progressive disclosure of complexity, allowing users to customize model.fit for advanced training loops.
  • πŸ’» Multi-device distribution can be enabled using Keras's distribution APIs, including DeviceMesh and LayoutMap for sharding model weights.
  • βš™οΈ For ultimate control, users can override core training steps, such as compute_loss and updates, for custom loss functions and tailored training loops.

Backend Agnosticism and Keras Hub

  • πŸ”„ Keras APIs are backend-agnostic, supporting JAX, TensorFlow, and PyTorch, with the ability to switch backends easily by setting an environmental variable.
  • 🧩 You can mix and match training frameworks and data pipelines, for example, using a TF.data pipeline with a JAX backend.
  • πŸ“š Keras Hub offers a rich collection of over 211 model variants based on 44+ architectures like Gemma, Llama, and Stable Diffusion, ready for use with JAX, TensorFlow, or PyTorch.
  • 🀝 Keras Hub integrates seamlessly with platforms like Kaggle and Hugging Face, providing access to presets, checkpoints, and community guides.

Fine-tuning and Model Components

  • 🎯 Keras Hub models can be fine-tuned using standard model.fit or advanced techniques like LoRA and QLoRA for parameter-efficient training.
  • 🧩 Task models in Keras Hub consist of a backbone, a pre-processor, and a task head, simplifying the pipeline from raw data to predictions.
  • πŸ”§ Components like backbones, pre-processors, and tokenizers can be instantiated using the from_preset method for easy integration of pre-trained weights and configurations.

Keras Recommenders

  • 🎯 Keras Recommenders is a new library for building state-of-the-art recommendation systems with JAX, TensorFlow, or PyTorch.
  • πŸ“ˆ It supports a two-phase approach (retrieval and ranking) and multitask models, with specialized layers, losses, and metrics for recommender models.
  • 🧠 Sequential recommender models, like GRU4Rec, can be built using a two-tower architecture with Keras Recommenders and trained with model.fit.
  • ☁️ The distributed embedding layer in Keras Recommenders leverages specialized hardware like Google's TPUs for efficient handling of large embedding tables across multiple devices.
Knowledge graph40 entities Β· 37 connections

How they connect

An interactive map of every person, idea, and reference from this conversation. Hover to trace connections, click to explore.

Hover Β· drag to explore
40 entities
Chapters8 moments

Key Moments

Transcript71 segments

Full Transcript

Topics15 themes

What’s Discussed

KerasJAXmodel.fitDeep LearningMachine LearningKeras HubKeras RecommendersLoRAQLoRADistributed TrainingModel ParallelismRecommendation SystemsEmbeddingsTensorFlowPyTorch
Smart Objects40 Β· 37 links
ProductsΒ· 8
ConceptsΒ· 22
CompaniesΒ· 4
MediasΒ· 5
LocationΒ· 1