Importing fedlab.contrib.algorithm.basic_client executes the __init__.py, which imports from qfedavg.py. This results in a
NameError: name 'SGDSerialClientTrainer' is not defined. Did you mean: 'SGDClientTrainer'?
The full stacktrace is below:
(.venv) ~/code/techwizrd-FedLab> python -c "from fedlab.contrib.algorithm.basic_client import SGDSerialClientTrainer"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/kunal/code/techwizrd-FedLab/fedlab/contrib/algorithm/__init__.py", line 13, in <module>
from .qfedavg import qFedAvgClientTrainer, qFedAvgServerHandler
File "/home/kunal/code/techwizrd-FedLab/fedlab/contrib/algorithm/qfedavg.py", line 75, in <module>
class qFedAvgSerialClientTrainer(SGDSerialClientTrainer):
^^^^^^^^^^^^^^^^^^^^^^
NameError: name 'SGDSerialClientTrainer' is not defined. Did you mean: 'SGDClientTrainer'?
Environment
Environment you use when bug appears:
Python version: Python 3.11.4
PyTorch Version: 2.2.0+cu121
FedLab version: 1.3.0
code you run:
from fedlab.contrib.algorithm.basic_client import SGDSerialClientTrainer
the detailed error:
NameError: name 'SGDSerialClientTrainer' is not defined. Did you mean: 'SGDClientTrainer'?
Additional context
I believe this bug was introduced in 698746e62ab9c8454b22d1c4864489579e0c7da5 which introduced a dependency on SGDSerialClientTrainer in qfedavg.py, and can be fixed simply by adding an import of SGDSerialClientTrainer.
Describe the bug
Importing
fedlab.contrib.algorithm.basic_client
executes the__init__.py
, which imports fromqfedavg.py
. This results in aThe full stacktrace is below:
Environment Environment you use when bug appears:
Additional context
I believe this bug was introduced in 698746e62ab9c8454b22d1c4864489579e0c7da5 which introduced a dependency on
SGDSerialClientTrainer
inqfedavg.py
, and can be fixed simply by adding an import ofSGDSerialClientTrainer
.