SliencerX / Learning-to-Attack-Federated-Learning

MIT License
14 stars 4 forks source link

ModuleNotFoundError: No module named 'fedtrain' #2

Closed Nathenial closed 1 year ago

Nathenial commented 1 year ago

Hi, I'm currently trying to learn and reproduce your paper's code. I am new to the field of AI security. I tried to run your code on Colab, but when I run "python3 sim-train.py", the error message says that the fedtrain package is missing. Could you please tell me how to install this package?

This is what I got.

[10, 11, 10, 10, 10, 9, 10, 10, 10, 10]
attacker ids:  [6, 11, 17, 18, 20, 24, 29, 36, 37, 38, 41, 42, 50, 51, 53, 56, 61, 94, 95, 96]
2023-03-22 03:45:57.772040: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-03-22 03:45:58.756744: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.9/dist-packages/cv2/../../lib64:/usr/lib64-nvidia
2023-03-22 03:45:58.756890: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.9/dist-packages/cv2/../../lib64:/usr/lib64-nvidia
2023-03-22 03:45:58.756911: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: 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.
Traceback (most recent call last):
  File "/content/gdrive/MyDrive/AISecurity/Learning-to-Attack-Federated-Learning-main/Learning-to-Attack-Federated-Learning-main/sim_train.py", line 38, in <module>
    import fedtrain
ModuleNotFoundError: No module named 'fedtrain'
---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
[<ipython-input-13-2d7d316d0beb>](https://localhost:8080/#) in <module>
----> 1 get_ipython().run_cell_magic('sh', '', 'python3 /content/gdrive/MyDrive/AISecurity/Learning-to-Attack-Federated-Learning-main/Learning-to-Attack-Federated-Learning-main/sim_train.py\n')

4 frames
<decorator-gen-103> in shebang(self, line, cell)

[/usr/local/lib/python3.9/dist-packages/IPython/core/magics/script.py](https://localhost:8080/#) in shebang(self, line, cell)
    243             sys.stderr.flush()
    244         if args.raise_error and p.returncode!=0:
--> 245             raise CalledProcessError(p.returncode, cell, output=out, stderr=err)
    246 
    247     def _run_script(self, p, cell, to_close):

CalledProcessError: Command 'b'python3 /content/gdrive/MyDrive/AISecurity/Learning-to-Attack-Federated-Learning-main/Learning-to-Attack-Federated-Learning-main/sim_train.py\n'' returned non-zero exit status 1.

This is a bit urgent for me, so if you could reply as soon as you have time, I would really appreciate it.

Nathenial commented 1 year ago

By the way, Could you please provide the hardware specifications required to run the code, such as GPU?

SliencerX commented 1 year ago

Hi, Thank you for your interest in our work. This code is written for running locally intead of running on Colab or other python notebook platform. The two key packages you need to install is Stablebaseline3(with coresponding pytorch and cuda toolkit) and more-itertools. For hardware we run the code, I think we mentioned it in the paper and you can check with it.

Sincerely.

Nathenial commented 1 year ago

Thanks for your quick answer!