Closed SydSeyedi closed 1 year ago
Hi @SydSeyedi could you post the exact error message? It would be helpful to debug your issue.
Hi @amad-person Sorry for delay, your response skipped my attention. When I use "pip install -r requirements.txt" and then in ipython I try: "import keras" I get the following error: "Using TensorFlow backend. 2021-03-08 12:23:25.329609: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /opt/rh/rh-python36/root/usr/lib64:/usr/lib64/mpich/lib:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64 2021-03-08 12:23:25.359718: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /opt/rh/rh-python36/root/usr/lib64:/usr/lib64/mpich/lib:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64 2021-03-08 12:23:25.359807: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly. " So I updated by: "pip install tensorflow-gpu==2.2.0 pip install tensorflow==2.2.0" but then "cprefix = 'alexnet_pretrained' cmodelA = tf.keras.models.load_model(cprefix)" results in: "privacy_meter/lib/python3.6/site-packages/tensorflow/python/keras/layers/core.py:1030: UserWarning: onnx2keras.reshape_layers is not loaded, but a Lambda layer uses it. It may cause errors. , UserWarning) XXX lineno: 161, opcode: 160" and many lines of error ending with: "privacy_meter/lib/python3.6/site-packages/tensorflow/python/keras/layers/core.py in target_layer(x) 159 [ 7.5 8.75] 160 [10. 0. ]], shape=(5, 2), dtype=float32) --> 161 162 Arguments: 163 rate: Float between 0 and 1. Fraction of the input units to drop.
SystemError: unknown opcode " So, what would be the solution? Thank you
Hello together, I got a similar error:
45: UserWarning: onnx2keras.reshape_layers is not loaded, but a Lambda layer uses it. It may cause errors.
, UserWarning)
XXX lineno: 160, opcode: 100
Traceback (most recent call last):
File "tutorials/attack_alexnet.py", line 13, in <module>
cmodelA = tf.keras.models.load_model(cprefix)
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/keras/saving/save.py", line 187, in load_model
return saved_model_load.load(filepath, compile, options)
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/keras/saving/saved_model/load.py", line 121, in load
path, options=options, loader_cls=KerasObjectLoader)
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/saved_model/load.py", line 633, in load_internal
ckpt_options)
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/keras/saving/saved_model/load.py", line 194, in __init__
super(KerasObjectLoader, self).__init__(*args, **kwargs)
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/saved_model/load.py", line 130, in __init__
self._load_all()
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/keras/saving/saved_model/load.py", line 221, in _load_all
self._finalize_objects()
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/keras/saving/saved_model/load.py", line 530, in _finalize_objects
self._reconstruct_all_models()
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/keras/saving/saved_model/load.py", line 548, in _reconstruct_all_models
self._reconstruct_model(model_id, model, layers)
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/keras/saving/saved_model/load.py", line 589, in _reconstruct_model
config, created_layers={layer.name: layer for layer in layers})
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/keras/engine/functional.py", line 1214, in reconstruct_from_config
process_node(layer, node_data)
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/keras/engine/functional.py", line 1162, in process_node
output_tensors = layer(input_tensors, **kwargs)
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/keras/engine/base_layer.py", line 926, in __call__
input_list)
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1117, in _functional_construction_call
outputs = call_fn(cast_inputs, *args, **kwargs)
File "/Users/christianstudinsky/opt/anaconda3/envs/ml_privacy_meter_35/lib/python3.5/site-packages/tensorflow/python/keras/layers/core.py", line 903, in call
result = self.function(inputs, **kwargs)
File "/home/mihir/Downloads/alexnet/venv2/lib/python3.7/site-packages/onnx2keras/reshape_layers.py", line 160, in target_layer
SystemError: unknown opcode
It seems that the problem is that the pretrained model with its custom functions were serialized by a different python version compared to yours.
If I resolved this problem, I can post the solution here.
Hi all, I think the issue is both the python version and the tensorflow version being used. We've used the following versions to test the library:
3.6
2.1
I am unable to reproduce your errors on my machine, please try to run the code with the above versions and let me know if there is any issue! Thanks.
This is the exact requirements.txt file.
Another solution would be to train a new AlexNet model on your end using the AlexNet train script provided in the repository.
It cause some error when trying to load "alexnet_pretrained". hdf5 save would be appreciated.