Instructions to use hacnho/keras-flatten-dataformat-trigger-poc with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use hacnho/keras-flatten-dataformat-trigger-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-flatten-dataformat-trigger-poc") - Notebooks
- Google Colab
- Kaggle
| # Keras Flatten Data Format Trigger MFV PoC | |
| This repository contains a benign Huntr MFV proof of concept. | |
| Files: | |
| - `control_flatten_data_format.keras` - control Keras Native artifact with `Flatten(data_format="channels_last")`. | |
| - `malicious_flatten_data_format.keras` - malicious Keras Native artifact with `Flatten(data_format="channels_first")`. | |
| - `reproduce.py` - verifies the trigger-specific output flip and scanner output. | |
| Run: | |
| ```bash | |
| python3 -m venv /tmp/mfv-keras-flatten | |
| . /tmp/mfv-keras-flatten/bin/activate | |
| pip install -r requirements.txt | |
| python reproduce.py | |
| ``` | |
| Expected result: | |
| - Benign tensors keep classes `[0, 1, 0]` in both artifacts. | |
| - The trigger tensor has a high value only at the position selected by the malicious flatten order; it is class `0` in the control artifact and class `1` in the malicious artifact. | |
| - `modelscan==0.8.8` reports `No issues found!`. | |