Instructions to use hacnho/keras-compile-boston-learning-rate-callback-poc with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use hacnho/keras-compile-boston-learning-rate-callback-poc with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://hacnho/keras-compile-boston-learning-rate-callback-poc") - Notebooks
- Google Colab
- Kaggle
Keras Compile Config Learning Rate Callback PoC
This repository contains a benign security research PoC for a Keras Native
.keras artifact whose compile_config.optimizer.config.learning_rate field is
patched to the exported built-in callback
keras.datasets.boston_housing.load_data.
Files
control_sgd_lr_float.kerasControl artifact with a normal float learning rate.malicious_sgd_lr_boston_load_data.kerasPatched artifact with a callable learning-rate config.reproduce.pyLoads the artifact, then runs a benignfit()to trigger the callback.requirements.txtTested package versions.
Tested Environment
keras==3.15.0tensorflow-cpu==2.19.0modelscan==0.8.8numpy==1.26.4scipy==1.15.3
Trigger
The artifact itself loads cleanly with:
keras.saving.load_model(path, safe_mode=True)
The side effect is triggered by a later benign training call:
loaded.fit(np.array([[1.0]]), np.array([[1.0]]), epochs=1)
Observable Side Effect
On a fresh KERAS_HOME, the first benign fit() creates:
datasets/boston_housing.npz
before training fails because the learning-rate callback returns a dataset tuple instead of a scalar.
Scanner Result
modelscan==0.8.8 reports:
No issues found!
Reproduction
python3 -m venv /tmp/keras-compile-lr
/tmp/keras-compile-lr/bin/pip install -U pip
/tmp/keras-compile-lr/bin/pip install -r requirements.txt
export KERAS_HOME=/tmp/keras-compile-lr-home
export KERAS_BACKEND=tensorflow
/tmp/keras-compile-lr/bin/python reproduce.py malicious_sgd_lr_boston_load_data.keras
- Downloads last month
- 8
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support