TsingZ0 / PFLlib

37 traditional FL (tFL) or personalized FL (pFL) algorithms, 3 scenarios, and 20 datasets.
GNU General Public License v2.0
1.45k stars 300 forks source link

There is a problem when using Shakespeare dataset #205

Closed Heisenberg1159 closed 2 months ago

Heisenberg1159 commented 2 months ago

It seems that different errors occur with all algorithms when running the Shakespeare NLP task in FedAvg.

My parameters: python main.py -data Shakespeare -m lstm -algo FedAvg -gr 2000 -did 0 -ls 5 -jr 0.1 -vs 80

Evaluate global model Traceback (most recent call last): File "F:\PFLlib\system\main.py", line 548, in run(args) File "F:\PFLlib\system\main.py", line 376, in run server.train() File "F:\PFLlib\system\flcore\servers\serveravg.py", line 48, in train self.evaluate() File "F:\PFLlib\system\flcore\servers\serverbase.py", line 245, in evaluate stats = self.test_metrics() ^^^^^^^^^^^^^^^^^^^ File "F:\PFLlib\system\flcore\servers\serverbase.py", line 219, in test_metrics ct, ns, auc = c.test_metrics() ^^^^^^^^^^^^^^^^ File "F:\PFLlib\system\flcore\clients\clientbase.py", line 114, in test_metrics output = self.model(x) ^^^^^^^^^^^^^ File "C:\Users\Heisenberg.conda\envs\fl\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Heisenberg.conda\envs\fl\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\PFLlib\system\flcore\trainmodel\models.py", line 34, in forward out = self.base(x) ^^^^^^^^^^^^ File "C:\Users\Heisenberg.conda\envs\fl\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Heisenberg.conda\envs\fl\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\PFLlib\system\flcore\trainmodel\models.py", line 439, in forward packed_embedded = nn.utils.rnn.pack_padded_sequence(embedded, text_lengths, batch_first=True, enforce_sorted=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Heisenberg.conda\envs\fl\Lib\site-packages\torch\nn\utils\rnn.py", line 264, in pack_padded_sequence _VF._pack_padded_sequence(input, lengths, batch_first) RuntimeError: 'lengths' argument should be a 1D CPU int64 tensor, but got 0D cpu Long tensor