Git Product home page Git Product logo

Comments (4)

amad-person avatar amad-person commented on June 12, 2024 1

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:

  1. Python 3.6
  2. Tensorflow 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.

from ml_privacy_meter.

amad-person avatar amad-person commented on June 12, 2024

Hi @SydSeyedi could you post the exact error message? It would be helpful to debug your issue.

from ml_privacy_meter.

SydSeyedi avatar SydSeyedi commented on June 12, 2024

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

from ml_privacy_meter.

chris-prenode avatar chris-prenode commented on June 12, 2024

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.

from ml_privacy_meter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.