| 101 | |
| 102 | |
| 103 | def 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 | |
| 129 | if __name__ == "__main__": |