chore(deps): Update dependency keras to v3#178
Open
renovate[bot] wants to merge 1 commit intomasterfrom
Open
Conversation
33964c0 to
8e3d120
Compare
8e3d120 to
b85553d
Compare
dd5fd91 to
1cfe049
Compare
mura-kisukirurira
previously approved these changes
Feb 9, 2024
ozaki0150
previously approved these changes
Feb 9, 2024
a3d4b6c
1cfe049 to
a3d4b6c
Compare
ozaki0150
previously approved these changes
Feb 15, 2024
6aa1910 to
3f29ed5
Compare
aeb8dc0 to
ed18add
Compare
064fdb2 to
4bd05b1
Compare
8afb5de to
a9aedf1
Compare
ozaki0150
previously approved these changes
Jul 17, 2024
a9aedf1 to
ce7fe8d
Compare
c2855bd to
2a09a25
Compare
2a09a25 to
e1961f5
Compare
e1961f5 to
a497bb1
Compare
a497bb1 to
a8c1e23
Compare
a8c1e23 to
5f8b43c
Compare
de52122 to
2eefbdc
Compare
2eefbdc to
4c2d3bc
Compare
50b3d16 to
8b3d108
Compare
8b3d108 to
18fa0b8
Compare
18fa0b8 to
1819890
Compare
1819890 to
ac439ea
Compare
ac439ea to
e4dfc31
Compare
e4dfc31 to
214a5fa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==2.15.0→==3.13.2Release Notes
keras-team/keras (keras)
v3.13.2Compare Source
Security Fixes & Hardening
This release introduces critical security hardening for model loading and saving, alongside improvements to the JAX backend metadata handling.
Disallow
TFSMLayerdeserialization insafe_mode(#22035)TFSMLayercould load external TensorFlow SavedModels during deserialization without respecting Kerassafe_mode. This could allow the execution of attacker-controlled graphs during model invocation.TFSMLayernow enforcessafe_modeby default. Deserialization viafrom_config()will raise aValueErrorunlesssafe_mode=Falseis explicitly passed orkeras.config.enable_unsafe_deserialization()is called.Fix Denial of Service (DoS) in
KerasFileEditor(#21880).kerasfile editor against malicious metadata that could cause dimension overflows or unbounded memory allocation (unbounded numpy allocation of multi-gigabyte tensors).Block External Links in HDF5 files (#22057)
Backend-specific Improvements (JAX)
mutable=Trueby default innnx_metadata(#22074)nnx_metadata.Saving & Serialization
H5IOStoreandShardedH5IOStoreto remove unused, unverified methods.Contributors
We would like to thank the following contributors for their security reports and code improvements:
@0xManan, @HyperPS, @hertschuh, and @divyashreepathihalli.
Full Changelog: keras-team/keras@v3.13.1...v3.13.2
v3.13.1Compare Source
Bug Fixes & Improvements
import keraswhen using NumPy 2.0 or higher. (#21949)Full Changelog: keras-team/keras@v3.13.0...v3.13.1
v3.13.0Compare Source
BREAKING changes
Starting with version 3.13.0, Keras now requires
Python 3.11or higher. Please ensure your environment is updated to Python 3.11+ to install the latest version.Highlights
LiteRT Export
You can now export Keras models directly to the LiteRT format (formerly TensorFlow Lite) for on-device inference.
This changes comes with improvements to input signature handling and export utility documentation. The changes ensure that LiteRT export is only available when TensorFlow is installed, update the export API and documentation, and enhance input signature inference for various model types.
Example:
GPTQ Quantization
Introduced
keras.quantizers.QuantizationConfigAPI that allows for customizable weight and activation quantizers, providing greater flexibility in defining quantization schemes.Introduced a new
filtersargument to theModel.quantizemethod, allowing users to specify which layers should be quantized using regex strings, lists of regex strings, or a callable function. This provides fine-grained control over the quantization process.Refactored the GPTQ quantization process to remove heuristic-based model structure detection. Instead, the model's quantization structure can now be explicitly provided via
GPTQConfigor by overriding a newModel.get_quantization_layer_structuremethod, enhancing flexibility and robustness for diverse model architectures.Core layers such as
Dense,EinsumDense,Embedding, andReversibleEmbeddinghave been updated to accept and utilize the newQuantizationConfigobject, enabling fine-grained control over their quantization behavior.Added a new method
get_quantization_layer_structureto the Model class, intended for model authors to define the topology required for structure-aware quantization modes like GPTQ.Introduced a new utility function
should_quantize_layerto centralize the logic for determining if a layer should be quantized based on the provided filters.Enabled the serialization and deserialization of
QuantizationConfigobjects within Keras layers, allowing quantized models to be saved and loaded correctly.Modified the
AbsMaxQuantizerto allow specifying the quantization axis dynamically during the__call__method, rather than strictly defining it at initialization.Example:
Applies the default
AbsMaxQuantizerto both weights and activations.Disable activation quantization by setting the activation quantizer to
None.Customize the value range or other parameters for specific quantizers.
Adaptive Pooling layers
Added adaptive pooling operations
keras.ops.nn.adaptive_average_poolandkeras.ops.nn.adaptive_max_poolfor1D,2D, and3Dinputs. These operations transform inputs of varying spatial dimensions into a fixed target shape defined byoutput_sizeby dynamically inferring the required kernel size and stride. Added corresponding layers:keras.layers.AdaptiveAveragePooling1Dkeras.layers.AdaptiveAveragePooling2Dkeras.layers.AdaptiveAveragePooling3Dkeras.layers.AdaptiveMaxPooling1Dkeras.layers.AdaptiveMaxPooling2Dkeras.layers.AdaptiveMaxPooling3DNew features
keras.ops.numpy.array_splitop a fundamental building block for tensor parallelism.keras.ops.numpy.empty_likeop.keras.ops.numpy.ldexpop.keras.ops.numpy.vanderop which constructs a Vandermonde matrix from a 1-D input tensor.keras.distribution.get_device_countutility function for distribution API.keras.layers.JaxLayerandkeras.layers.FlaxLayernow support the TensorFlow backend in addition to the JAX backed. This allows you to embedflax.linen.Moduleinstances or JAX functions in your model. The TensorFlow support is based onjax2tf.OpenVINO Backend Support:
numpy.digitizesupport.numpy.diagsupport.numpy.isinsupport.numpy.vdotsupport.numpy.floor_dividesupport.numpy.rollsupport.numpy.multi_hotsupport.numpy.psnrsupport.numpy.empty_likesupport.Bug fixes and Improvements
attention_axesforMultiHeadAttentionlayers.Softmaxmask handling, aimed at improving numerical robustness, was based on a deep investigation led by Jaswanth Sreeram, who prototyped the solution with contributions from others.Normalizationlayer'sadaptmethod now supportsPyDatasetobjects, allowing for proper adaptation when using this data type.TPU Test setup
Configured the TPU testing infrastructure to enforce unit test coverage across the entire codebase. This ensures that both existing logic and all future contributions are validated for functionality and correctness within the TPU environment.
New Contributors
Full Changelog: keras-team/keras@v3.12.0...v3.13.0
v3.12.1Compare Source
Security Fixes & Hardening
This release introduces critical security hardening for model loading and saving, alongside improvements to the JAX backend metadata handling.
Disallow
TFSMLayerdeserialization insafe_mode(#22035)TFSMLayercould load external TensorFlow SavedModels during deserialization without respecting Kerassafe_mode. This could allow the execution of attacker-controlled graphs during model invocation.TFSMLayernow enforcessafe_modeby default. Deserialization viafrom_config()will raise aValueErrorunlesssafe_mode=Falseis explicitly passed orkeras.config.enable_unsafe_deserialization()is called.Fix Denial of Service (DoS) in
KerasFileEditor(#21880).kerasfile editor against malicious metadata that could cause dimension overflows or unbounded memory allocation (unbounded numpy allocation of multi-gigabyte tensors).Block External Links in HDF5 files (#22057)
Saving & Serialization
H5IOStoreandShardedH5IOStoreto remove unused, unverified methods.Acknowledgments
Special thanks to the security researchers and contributors who reported these vulnerabilities and helped implement the fixes: @0xManan, @HyperPS, and @hertschuh.
Full Changelog: keras-team/keras@v3.12.0...v3.12.1
v3.12.0: Keras 3.12.0Compare Source
Highlights
Keras has a new model distillation API!
You now have access to an easy-to-use API for distilling large models into small models while minimizing performance drop on a reference dataset -- compatible with all existing Keras models. You can specify a range of different distillation losses, or create your own losses. The API supports multiple concurrent distillation losses at the same time.
Example:
Keras supports GPTQ quantization!
GPTQ is now built into the Keras API. GPTQ is a post-training, weights-only quantization method that compresses a model to int4 layer by layer. For each layer, it uses a second-order method to update weights while minimizing the error on a calibration dataset.
Learn how to use it in this guide.
Example:
Better support for Grain datasets!
keras.utils.image_dataset_from_directoryandkeras.utils.text_dataset_from_directory. Specifyformat="grain"to return a Grain dataset instead of a TF dataset.New features
keras.layers.ReversibleEmbeddinglayer: an embedding layer that can also also project backwards to the input space. Use it with thereverseargument incall().opset_versioninmodel.export(). Argument specific toformat="onnx"; specifies the ONNX opset version.keras.ops.isinop.keras.ops.isneginf,keras.ops.isposinfops.keras.ops.isrealop.keras.ops.cholesky_inverseop and addupperargument inkeras.ops.cholesky.keras.ops.image.scale_and_translateop.keras.ops.hypotop.keras.ops.gcdop.keras.ops.kronop.keras.ops.logaddexp2op.keras.ops.viewop.keras.ops.unfoldop.keras.ops.jvpop.keras.ops.trapezoidop.Breaking changes
StringLookup&IntegerLookupnow save vocabulary loaded from file. Previously, when instantiating these layers from a vocabulary filepath, only the filepath would be saved when saving the layer. Now, the entire vocabulary is materialized and saved as part of the.kerasarchive.Security fixes
safe_mode: CVE-2025-12058 and CVE-2025-12060.New Contributors
Full Changelog: keras-team/keras@v3.11.0...v3.12.0
v3.11.3: Keras 3.11.3Compare Source
What's Changed
Full Changelog: keras-team/keras@v3.11.2...v3.11.3
v3.11.2: Keras 3.11.2Compare Source
What's Changed
New Contributors
Full Changelog: keras-team/keras@v3.11.1...v3.11.2
v3.11.1: Keras 3.11.1Compare Source
What's Changed
Full Changelog: keras-team/keras@v3.11.0...v3.11.1
v3.11.0: Keras 3.11.0Compare Source
What's Changed
fit()/evaluate()/predict().keras.ops.kaiserfunction.keras.ops.hanningfunction.keras.ops.cbrtfunction.keras.ops.deg2radfunction.keras.ops.layer_normalizationfunction to leverage backend-specific performance optimizations.Backend-specific changes
JAX backend
TensorFlow backend
Flattenlayer.OpenVINO backend
New Contributors
Full Changelog: keras-team/keras@v3.10.0...v3.11.0
v3.10.0: Keras 3.10.0Compare Source
New features
model.save(). It is controlled via themax_shard_sizeargument. Specifying this argument will split your Keras model weight file into chunks of this size at most. Useload_model()to reload the sharded files.keras.optimizers.Muonkeras.layers.RandomElasticTransformkeras.losses.CategoricalGeneralizedCrossEntropy(with functional versionkeras.losses.categorical_generalized_cross_entropy)axisargument toSparseCategoricalCrossentropylora_alphato all LoRA-enabled layers. If set, this parameter scales the low-rank adaptation delta during the forward pass.keras.activations.sparse_sigmoidkeras.ops.image.elastic_transformkeras.ops.anglekeras.ops.bartlettkeras.ops.blackmankeras.ops.hammingkeras.ops.view_as_complex,keras.ops.view_as_realPyTorch backend
TensorFlow backend
tf.RaggedTensorsupport toEmbeddinglayersynchronizationargumentOpenVINO backend
New Contributors
Full Changelog: keras-team/keras@v3.9.0...v3.10.0
v3.9.2: Keras 3.9.2Compare Source
What's Changed
Full Changelog: keras-team/keras@v3.9.1...v3.9.2
v3.9.1: Keras 3.9.1Compare Source
What's Changed
Full Changelog: keras-team/keras@v3.9.0...v3.9.1
v3.9.0: Keras 3.9.0Compare Source
New features
keras.RematScopeandkeras.remat. It can be used to turn on rematerizaliation for certain layers in fine-grained manner, e.g. only for layers larger than a certain size, or for a specific set of layers, or only for activations.keras.ops.rot90keras.ops.rearrange(Einops-style)keras.ops.signbitkeras.ops.polarkeras.ops.image.perspective_transformkeras.ops.image.gaussian_blurkeras.layers.RMSNormalizationkeras.layers.AugMixkeras.layers.CutMixkeras.layers.RandomInvertkeras.layers.RandomErasingkeras.layers.RandomGaussianBlurkeras.layers.RandomPerspectivedtypeargument toJaxLayerandFlaxLayerlayersBinaryAccuracymetricantialiasargument tokeras.layers.Resizinglayer.npzmodel files (numpy format). Thanks to Peng Zhou for reporting the vulnerability.New Contributors
Full Changelog: keras-team/keras@v3.8.0...v3.9.0
v3.8.0: Keras 3.8.0Compare Source
New: OpenVINO backend
OpenVINO is now available as an infererence-only Keras backend. You can start using it by setting the
backendfield to"openvino"in yourkeras.jsonconfig file.OpenVINO is a deep learning inference-only framework tailored for CPU (x86, ARM), certain GPUs (OpenCL capable, integrated and discrete) and certain AI accelerators (Intel NPU).
Because OpenVINO does not support gradients, you cannot use it for training (e.g.
model.fit()) -- only inference. You can train your models with the JAX/TensorFlow/PyTorch backends, and when trained, reload them with the OpenVINO backend for inference on a target device supported by OpenVINO.New: ONNX model export
You can now export your Keras models to the ONNX format from the JAX, TensorFlow, and PyTorch backends.
Just pass
format="onnx"in yourmodel.export()call:New: Scikit-Learn API compatibility interface
It's now possible to easily integrate Keras models into Sciki-Learn pipelines! The following wrapper classes are available:
keras.wrappers.SKLearnClassifier: implements the sklearnClassifierAPIkeras.wrappers.SKLearnRegressor: implements the sklearnRegressorAPIkeras.wrappers.SKLearnTransformer: implements the sklearnTransformerAPIOther feature additions
keras.ops.diagflatkeras.ops.unravel_indexsparse_plusactivationsparsemaxactivationkeras.layers.RandAugmentkeras.layers.Equalizationkeras.layers.MixUpkeras.layers.RandomHuekeras.layers.RandomGrayscalekeras.layers.RandomSaturationkeras.layers.RandomColorJitterkeras.layers.RandomColorDegenerationkeras.layers.RandomSharpnesskeras.layers.RandomShearaxistotverskylossJAX specific changes
TensorFlow specific changes
keras.random.shuffleXLA compilablePyTorch specific changes
model.export()andkeras.export.ExportArchivewith the PyTorch backend, supporting both the TF SavedModel format and the ONNX format.New Contributors
Full Changelog: keras-team/keras@v3.7.0...v3.8.0
v3.7.0: Keras 3.7.0Compare Source
API changes
flash_attentionargument tokeras.ops.dot_product_attentionand tokeras.layers.MultiHeadAttention.keras.layers.STFTSpectrogramlayer (to extract STFT spectrograms from inputs as a preprocessing step) as well as its initializerkeras.initializers.STFTInitializer.celu,glu,log_sigmoid,hard_tanh,hard_shrink,squareplusactivations.keras.losses.Circleloss.keras.visualization.draw_bounding_boxes,keras.visualization.draw_segmentation_masks,keras.visualization.plot_image_gallery,keras.visualization.plot_segmentation_mask_gallery.double_checkpointargument toBackupAndRestoreto save a fallback checkpoint in case the first checkpoint gets corrupted.CenterCrop,RandomFlip,RandomZoom,RandomTranslation,RandomCrop.keras.ops.exp2,keras.ops.inneroperations.Performance improvements
bias_add.New Contributors
Full Changelog: keras-team/keras@v3.6.0...v3.7.0
v3.6.0: Keras 3.6.0Compare Source
Highlights
keras.saving.KerasFileEditor. Use it to inspect, diff, modify and resave Keras weights files. See basic workflow here.keras.utils.Configclass for managing experiment config parameters.BREAKING changes
keras.utils.get_file, withextract=Trueoruntar=True, the return value will be the path of the extracted directory, rather than the path of the archive.Other changes and additions
fit(),evaluate(),predict(). This enables 100% compact stacking oftrain_stepcalls on accelerators (e.g. when running small models on TPU).on_batch_end, this will disable async logging. You can force it back by addingself.async_safe = Trueto your callbacks. Note that theTensorBoardcallback isn't considered async safe by default. Default callbacks like the progress bar are async safe.keras.saving.KerasFileEditorutility to inspect, diff, modify and resave Keras weights file.keras.utils.Configclass. It behaves like a dictionary, with a few nice features:config.foo = 2orconfig["foo"]are both valid)config.to_json().config.freeze().bitwise_andbitwise_invertbitwise_left_shiftbitwise_notbitwise_orbitwise_right_shiftbitwise_xorkeras.ops.logdet.keras.ops.trunc.keras.ops.dot_product_attention.keras.ops.histogram.PyDatasetinstances to use multithreading.verboseinkeras.saving.ExportArchive.write_out()method for exporting TF SavedModel.epsilonargument inkeras.ops.normalize.Model.get_state_tree()method for retrieving a nested dict mapping variable paths to variable values (either as numpy arrays or backend tensors (default)). This is useful for rolling out custom JAX training loops.keras.layers.AutoContrast,keras.layers.Solarization.keras.layers.Pipelineclass, to apply a sequence of layers to an input. This class is useful to build a preprocessing pipeline. Compared to aSequentialmodel,Pipelinefeatures a few important differences:Model, just a plain layer.tf.data, the pipeline will also remaintf.datacompatible, independently of the backend you use.New Contributors
Full Changelog: keras-team/keras@v3.5.0...v3.6.0
v3.5.0: Keras 3.5.0Compare Source
What's Changed
keras.Model.save()and load.kerasmodels directly from Hugging Face Hub withkeras.saving.load_model().keras.optimizers.Lamboptimizer.keras.distributionAPI support for very large models.keras.ops.associative_scanop.keras.ops.searchsortedop.keras.utils.PyDataset.on_epoch_begin()method.data_formatargument tokeras.layers.ZeroPadding1Dlayer.Full Changelog: keras-team/keras@v3.4.1...v3.5.0
v3.4.1: Keras 3.4.1Compare Source
This is a minor bugfix release.
v3.4.0: Keras 3.4.0Compare Source
Highlights
keras.dtype_policies.DTypePolicyMapfor easy configuration of dtype policies of nested sublayers of a subclassed layer/model.keras.ops.argpartitionkeras.ops.scankeras.ops.lstsqkeras.ops.switchkeras.ops.dtypekeras.ops.mapkeras.ops.image.rgb_to_hsvkeras.ops.image.hsv_to_rgbWhat's changed
float8inference forDenseandEinsumDenselayers.nameargument in all Keras Applications models.axisargument inkeras.losses.Dice.keras.utils.FeatureSpaceto be used in atf.datapipeline even when the backend isn't TensorFlow.StringLookuplayer can now taketf.SparseTensoras input.Metric.variablesis now recursive.trainingargument toModel.compute_loss().dtypeargument to all losses.keras.utils.split_datasetnow supports nested structures in dataset.Full Changelog: keras-team/keras@v3.3.3...v3.4.0
v3.3.3: Keras 3.3.3Compare Source
This is a minor bugfix release.
v3.3.2: Keras 3.3.2Compare Source
This is a simple fix release that re-surfaces legacy Keras 2 APIs that aren't part of Keras package proper, but that are still featured in
tf.keras. No other content has changed.v3.3.1: Keras 3.3.1Compare Source
This is a simple fix release that moves the legacy
_tf_kerasAPI directory to the root of the Keras pip package. This is done in order to preserve import paths likefrom tensorflow.keras import layerswithout making any changes to the TensorFlow API files.No other content has changed.
v3.3.0: Keras 3.3.0Compare Source
What's Changed
keras.ops.ctc_decodefor JAX and TensorFlow.keras.ops.vectorize,keras.ops.select.keras.ops.image.rgb_to_grayscale.keras.losses.Tverskyloss.bincountanddigitizesparse support.In addition, the codebase structure has evolved:
keras/src/.keras/api/.pip installKeras directly from the GitHub sources.New Contributors
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.