google / scaaml

Apache License 2.0
130 stars 38 forks source link

Python venv not compatible with key_recovery_demo.ipynb #307

Closed mattiamirigaldi closed 4 weeks ago

mattiamirigaldi commented 4 weeks ago

Trying to load the model in cell 6 of key_recovery_demo.ipnb gives error

Code :

# let's select an attack point that have all the needed models -- Key is not a good target: it doesn't work
ATTACK_POINT = 'sub_bytes_out'

# let's also pick the key byte we want to use SCAAML to recover and load the related model
ATTACK_BYTE = 7

# load model
model = load_model_from_disk(available_models[ATTACK_POINT][ATTACK_BYTE])

Error

ValueError: File format not supported: filepath=models/stm32f415-tinyaes-cnn-v10-ap_sub_bytes_out-byte_7-len_20000. Keras 3 only supports V3 `.keras` files and legacy H5 format files (`.h5` extension). Note that the legacy SavedModel format is not supported by `load_model()` in Keras 3. 

The venv used is the one generated by requirements.txt

mattiamirigaldi commented 4 weeks ago

I solved it by downgrading my python version to 3.9 and using the tensorflow version 2.10 (and others by hand fix).

But I really think the notebook should be upgraded to be compatible with the venv build with the requirement file.