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

Function load_arguments

python/fedml/arguments.py:199–229  ·  view source on GitHub ↗
(training_type=None, comm_backend=None)

Source from the content-addressed store, hash-verified

197
198
199def load_arguments(training_type=None, comm_backend=None):
200 cmd_args = add_args()
201 # Load all arguments from YAML config file
202 args = Arguments(cmd_args, training_type, comm_backend)
203
204 current_version = os.getenv("FEDML_CURRENT_VERSION")
205 if current_version is not None and current_version != "":
206 setattr(args, "version", current_version)
207 setattr(args, "config_version", current_version)
208
209 using_mlops = os.getenv("FEDML_USING_MLOPS")
210 if using_mlops is not None:
211 setattr(args, "using_mlops", using_mlops)
212
213 if not hasattr(args, "worker_num") and hasattr(args, "client_num_per_round"):
214 args.worker_num = args.client_num_per_round
215
216 # os.path.expanduser() method in Python is used
217 # to expand an initial path component ~( tilde symbol)
218 # or ~user in the given path to user’s home directory.
219 if hasattr(args, "data_cache_dir"):
220 args.data_cache_dir = os.path.expanduser(args.data_cache_dir)
221 if hasattr(args, "data_file_path"):
222 args.data_file_path = os.path.expanduser(args.data_file_path)
223 if hasattr(args, "partition_file_path"):
224 args.partition_file_path = os.path.expanduser(args.partition_file_path)
225 if hasattr(args, "part_file"):
226 args.part_file = os.path.expanduser(args.part_file)
227
228 args.rank = int(args.rank)
229 return args

Callers 6

launch_dist_trainersMethod · 0.90
launch_dist_trainersMethod · 0.90
launch_dist_trainersMethod · 0.90
launch_dist_trainersMethod · 0.90
initFunction · 0.70
initFunction · 0.50

Calls 2

ArgumentsClass · 0.85
add_argsFunction · 0.70

Tested by

no test coverage detected