Вот мой скрипт Python:
Код: Выделить всё
import tensorflow as tf
from os import walk
from keras.models import load_model
from keras.applications.imagenet_utils import decode_predictions
_, _, files = next(walk("Flag"))
model = load_model("Model.h5", compile=False, safe_mode=False)
Код: Выделить всё
┌──(venv_c)─(kali㉿kali)-[~/deep_l_chal]
└─$ python3 py.py
2025-11-06 17:00:24.283330: I external/local_xla/xla/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used.
2025-11-06 17:00:24.348290: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2025-11-06 17:00:25.729639: I external/local_xla/xla/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used.
2025-11-06 17:00:26.059869: E external/local_xla/xla/stream_executor/cuda/cuda_platform.cc:51] failed call to cuInit: INTERNAL: CUDA error: Failed call to cuInit: UNKNOWN ERROR (303)
Traceback (most recent call last):
File "/home/kali/venv_c/lib/python3.13/site-packages/keras/src/ops/operation.py", line 317, in from_config
return cls(**config)
File "/home/kali/venv_c/lib/python3.13/site-packages/keras/src/layers/normalization/batch_normalization.py", line 143, in __init__
self.axis = int(axis)
~~~^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'
During handling of the above exception, another exception occurred:
......
......
[TRUNCATED FOR SANITY]
......
......
TypeError: could not be deserialized properly. Please ensure that components that are Python object instances (layers, models, etc.) returned by `get_config()` are explicitly deserialized in the model's `from_config()` method.
Вот мои версии модуля Python:
Код: Выделить всё
tensorboard 2.20.0
tensorboard-data-server 0.7.2
tensorflow 2.20.0
keras 3.12.0
Что я пробовал
- Я пытался понизить версию tensorflow до версии 2.15.0
- Я пытался импортировать import_model непосредственно из модуля tensorflow, например из tensorflow.keras.models import load_model
- Я пытался загрузить без Safe_mode model = load_model("Model.h5", compile=False, Safe_mode=False)
- Я пытался загрузить его из tf, например tf.keras.models.load_model("Model.h5")
Подробнее здесь: https://stackoverflow.com/questions/798 ... -of-batchn
Мобильная версия