Skip to content

Commit

Permalink
Better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbvll committed Dec 19, 2023
1 parent fda20f5 commit 3218dfd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions examples/mt-pytorch-callable/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.runs_history
9 changes: 4 additions & 5 deletions examples/mt-pytorch-callable/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import torch
import torch.nn as nn
import torch.nn.functional as F
import wandb
from torch.utils.data import DataLoader
from torchvision.datasets import CIFAR10
from torchvision.transforms import Compose, Normalize, ToTensor
Expand Down Expand Up @@ -114,7 +113,7 @@ def client_fn(cid: str):
return FlowerClient().to_client()


def get_middleware(logdir):
def get_tensorboard_middleware(logdir):
os.makedirs(logdir, exist_ok=True)

# To allow multiple runs and group those we will create a subdir
Expand All @@ -131,7 +130,7 @@ def get_middleware(logdir):
run_id = run_id + "-" + datetime.datetime.now().strftime("%Y%m%dT%H%M%S")
logdir_run = os.path.join(logdir, run_id)

def wandb_middleware(fwd, app):
def tensorboard_middleware(fwd, app):
start_time = None

project_name = logdir
Expand Down Expand Up @@ -206,12 +205,12 @@ def wandb_middleware(fwd, app):

return bwd

return wandb_middleware
return tensorboard_middleware


# To run this: `flower-client --callable client:flower`
flower = fl.flower.Flower(
client_fn=client_fn, middleware=[get_middleware("MT PyTorch Callable")]
client_fn=client_fn, middleware=[get_tensorboard_middleware(".runs_history")]
)


Expand Down

0 comments on commit 3218dfd

Please sign in to comment.