Browse Source

fix: for debug

shellmiao 7 tháng trước cách đây
mục cha
commit
704700c0f1

+ 3 - 0
applications/fedssl/client_with_pgfed.py

@@ -149,6 +149,9 @@ class FedSSLWithPgFedClient(FedSSLClient):
             self.train_loss.append(float(current_epoch_loss))
 
         print(f"Batch privacy scores during training: {batch_privacy_scores}")
+        print(f"在第 {i+1} 轮训练结束时, a_i 的值为: {self.a_i}")
+        print(f"Sum of batch privacy scores during training: {sum(batch_privacy_scores)}")
+        
 
         self.loss_minus = 0.0
         test_num = 0

+ 2 - 1
applications/fedssl/server_with_pgfed.py

@@ -113,7 +113,8 @@ class FedSSLWithPgFedServer(FedSSLServer):
             self.uploaded_ids.append(client.id)
             self.alpha_mat[client.id] = client.a_i
             self.uploaded_grads[client.id] = client.latest_grad
-            self.loss_minuses[client.id] = client.loss_minus * self.mu
+            print("client.loss_minus:",client.loss_minus)
+            self.loss_minuses[client.id] = client.loss_minus
     
     def get_mean_grad(self):
         w = self.mu/self.conf.server.clients_per_round