$ show keras-team/keras
Keras 3 is a multi-backend deep learning framework that provides a high-level API for building and training neural networks. It supports TensorFlow, JAX, PyTorch, NumPy, and OpenVINO backends, allowing users to switch between them with minimal code changes. The repository contains a comprehensive set of layers (convolutional, recurrent, attention, normalization, pooling, preprocessing, regularization), optimizers (Adam, SGD, AdamW, Lion, etc.), metrics, callbacks, loss functions, and utilities for model saving/loading, quantization, distillation, and distributed training. The architecture is modular with a clean separation between backend-agnostic operations and backend-specific implementations. The codebase is well-tested with extensive unit and integration tests, and includes benchmarks for performance comparison. It is actively maintained with frequent commits and responsive issue triage.
The LLM identified 5 files worth highlighting for reuse:
Provides a base class for image preprocessing layers that supports transforming images, labels, bounding boxes, and segmentation masks in a unified way. It handles data format (channels_last/first), random seed generation, and serialization. This pattern is reusable for any image augmentation layer and demonstrates careful design for multi-target augmentation pipelines.
A stateful random number generator that maintains a seed and provides methods to generate new seeds for each call. It is used across all random layers to ensure reproducibility across backends. The implementation is simple, self-contained, and can be extracted for any project requiring deterministic randomness.
A context manager for hierarchical variable naming, similar to TensorFlow's name_scope. It supports nested scopes, thread safety, and automatic name generation. This is a reusable pattern for any framework that needs to organize variables or operations in a tree structure.
An abstract base class for callbacks that monitor a metric during training. It provides logic for tracking best values, patience, and mode (min/max/auto). Used by EarlyStopping, ReduceLROnPlateau, and ModelCheckpoint. This is a well-designed template for any training loop that needs metric-based decisions.
A MutableMapping that maps layer paths to dtype policies, supporting exact and regex-based matching. It allows setting dtype policies for groups of layers (e.g., all Dense layers) and serializes/deserializes cleanly. This is a reusable component for any framework needing per-layer dtype configuration.