{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import json\n", "\n", "for i in ['MobileNet','ResNet']:\n", " for j in [True,False]:\n", " for k,l in [(20,1),(1,20),(10,10)]:\n", " if (i=='MobileNet'):\n", " for m in [150,164]:\n", " args = {\n", " \"epochs\" : k, # Number of Global Aggregation Rounds\n", " \"num_users\":10, # Number of Clients\n", " \"local_ep\": l, # Number of local epochs on each client\n", " \"local_bs\" : 128, # Batch size for each client\n", " \"bs\" : 128, # Batch size for global model\n", " \"lr\" : 0.01, # Learning rate (alpha)\n", " \"momentum\" : 0.9, # Momentum for SGD\n", " \"split_ratio\" : 0.9, # Ratio for splitting client data into training and testing \n", " \"overlapping_classes\" : 4, # In non-iid distribution, no of classes from which a particular user gets the data from\n", " \"base_layers\" : m, # Base layers of local models\n", " \"model\" : i, # Model used for training\n", " \"dataset\" :'cifar', # Dataset \n", " \"iid\":j, # Data Distribution\n", " \"num_classes\" : 10, # Number of classes in the dataset\n", " \"gpu\": 0, # GPU id\n", " \"seed\" : 1, # Seeding\n", " }\n", "\n", "\n", " with open('./{}_{}_{}_{}.txt'.format(i,str(j),k,m),'w') as outfile:\n", " json.dump(args,outfile,indent=4)\n", " \n", " else:\n", " for m in [204,218]:\n", " args = {\n", " \"epochs\" : k, # Number of Global Aggregation Rounds\n", " \"num_users\":10, # Number of Clients\n", " \"local_ep\": l, # Number of local epochs on each client\n", " \"local_bs\" : 128, # Batch size for each client\n", " \"bs\" : 128, # Batch size for global model\n", " \"lr\" : 0.01, # Learning rate (alpha)\n", " \"momentum\" : 0.9, # Momentum for SGD\n", " \"split_ratio\" : 0.9, # Ratio for splitting client data into training and testing \n", " \"overlapping_classes\" : 4, # In non-iid distribution, no of classes from which a particular user gets the data from\n", " \"base_layers\" : m, # Base layers of local models\n", " \"model\" : i, # Model used for training\n", " \"dataset\" :'cifar', # Dataset \n", " \"iid\":j, # Data Distribution\n", " \"num_classes\" : 10, # Number of classes in the dataset\n", " \"gpu\": 0, # GPU id\n", " \"seed\" : 1, # Seeding\n", " }\n", "\n", "\n", " with open('./{}_{}_{}_{}.txt'.format(i,str(j),k,m),'w') as outfile:\n", " json.dump(args,outfile,indent=4)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import json\n", "\n", " args = {\n", " \"epochs\" : 2, # Number of Global Aggregation Rounds\n", " \"num_users\":10, # Number of Clients\n", " \"local_ep\": 2, # Number of local epochs on each client\n", " \"local_bs\" : 128, # Batch size for each client\n", " \"bs\" : 128, # Batch size for global model\n", " \"lr\" : 0.01, # Learning rate (alpha)\n", " \"momentum\" : 0.9, # Momentum for SGD\n", " \"split_ratio\" : 0.9, # Ratio for splitting client data into training and testing \n", " \"overlapping_classes\" : 4, # In non-iid distribution, no of classes from which a particular user gets the data from\n", " \"base_layers\" : 204, # Base layers of local models\n", " \"model\" : 'ResNet' , # Model used for training\n", " \"dataset\" :'cifar', # Dataset \n", " \"iid\":True, # Data Distribution\n", " \"num_classes\" : 10, # Number of classes in the dataset\n", " \"gpu\": 0, # GPU id\n", " \"seed\" : 1, # Seeding\n", " }\n", "\n", "\n", " with open('./{}_{}_{}_{}.txt'.format(args.model,,k,m),'w') as outfile:\n", " json.dump(args,outfile,indent=4)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" } }, "nbformat": 4, "nbformat_minor": 2 }