Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix args changes in examples and utils #178

Merged
merged 1 commit into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/Femnist_stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import matplotlib.pyplot as plt
import numpy as np

# Make sure you have downloaded and installed FedScale
import fedscale.core.config_parser as parser
from fedscale.dataloaders.femnist import FEMNIST
from fedscale.dataloaders.utils_data import get_data_transform
from fedscale.dataloaders.divide_data import DataPartitioner
from fedscale.core.config_parser import args
```


Expand All @@ -33,10 +33,10 @@ test_dataset = FEMNIST('./benchmark/dataset/data/femnist', dataset='test', trans
Partition the dataset by the `client_data_mapping` file, which gives the real-world client-level heterogeneity.

```{code-cell}
args.task = 'cv'
training_sets = DataPartitioner(data=train_dataset, args=args, numOfClass=62)
parser.args.task = 'cv'
training_sets = DataPartitioner(data=train_dataset, args=parser.args, numOfClass=62)
training_sets.partition_data_helper(num_clients=None, data_map_file='./benchmark/dataset/data/femnist/client_data_mapping/train.csv')
#testing_sets = DataPartitioner(data=test_dataset, args=args, numOfClass=62, isTest=True)
#testing_sets = DataPartitioner(data=test_dataset, args=parser.args, numOfClass=62, isTest=True)
#testing_sets.partition_data_helper(num_clients=None, data_map_file='./benchmark/dataset/data/femnist/client_data_mapping/train.csv')
```

Expand Down Expand Up @@ -76,7 +76,7 @@ rank=1
isTest = False
dropLast = True
partition = training_sets.use(rank - 1, isTest)
num_loaders = min(int(len(partition)/ args.batch_size/2), args.num_loaders)
num_loaders = min(int(len(partition)/ parser.args.batch_size/2), parser.args.num_loaders)
dataloader = DataLoader(partition, batch_size=16, shuffle=True, pin_memory=True, timeout=60, num_workers=num_loaders, drop_last=dropLast)
```

Expand Down
4 changes: 2 additions & 2 deletions examples/heterofl/customized_fllibs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import torch.nn.functional as F
from resnet_heterofl import resnet18

from fedscale.core.config_parser import args
import fedscale.core.config_parser as parser


def init_model():
global tokenizer

logging.info("Initializing the model ...")
if args.model == 'resnet_heterofl':
if parser.args.model == 'resnet_heterofl':
model = resnet18()

return model
Expand Down
Loading