MCPcopy
hub / github.com/FedML-AI/FedML / load_arguments

Function load_arguments

python/examples/simulation/sp_custom/main.py:103–126  ·  view source on GitHub ↗
(training_type=None, comm_backend=None)

Source from the content-addressed store, hash-verified

101
102
103def load_arguments(training_type=None, comm_backend=None):
104 cmd_args = add_args()
105 logging.info(f"cmd_args: {cmd_args}")
106
107 # Load all arguments from YAML config file
108 args = Arguments(cmd_args, training_type, comm_backend, override_cmd_args=cmd_args.override_cmd_args)
109
110 # if not hasattr(args, "worker_num"):
111 # args.worker_num = args.client_num_per_round
112
113 # os.path.expanduser() method in Python is used
114 # to expand an initial path component ~( tilde symbol)
115 # or ~user in the given path to user’s home directory.
116 if hasattr(args, "data_cache_dir"):
117 args.data_cache_dir = os.path.expanduser(args.data_cache_dir)
118 if hasattr(args, "data_file_path"):
119 args.data_file_path = os.path.expanduser(args.data_file_path)
120 if hasattr(args, "partition_file_path"):
121 args.partition_file_path = os.path.expanduser(args.partition_file_path)
122 if hasattr(args, "part_file"):
123 args.part_file = os.path.expanduser(args.part_file)
124
125 args.rank = int(args.rank)
126 return args
127
128
129if __name__ == "__main__":

Callers 1

main.pyFile · 0.70

Calls 3

ArgumentsClass · 0.90
add_argsFunction · 0.70
infoMethod · 0.45

Tested by

no test coverage detected