| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| from accelerate.commands.config import get_config_parser |
| from accelerate.commands.env import env_command_parser |
| from accelerate.commands.estimate import estimate_command_parser |
| from accelerate.commands.launch import launch_command_parser |
| from accelerate.commands.merge import merge_command_parser |
| from accelerate.commands.test import test_command_parser |
| from accelerate.commands.to_fsdp2 import to_fsdp2_command_parser |
| from accelerate.commands.tpu import tpu_command_parser |
| from accelerate.commands.utils import CustomArgumentParser |
|
|
|
|
| def main(): |
| parser = CustomArgumentParser("Accelerate CLI tool", usage="accelerate <command> [<args>]", allow_abbrev=False) |
| subparsers = parser.add_subparsers(help="accelerate command helpers") |
|
|
| |
| get_config_parser(subparsers=subparsers) |
| estimate_command_parser(subparsers=subparsers) |
| env_command_parser(subparsers=subparsers) |
| launch_command_parser(subparsers=subparsers) |
| merge_command_parser(subparsers=subparsers) |
| tpu_command_parser(subparsers=subparsers) |
| test_command_parser(subparsers=subparsers) |
| to_fsdp2_command_parser(subparsers=subparsers) |
|
|
| |
| args = parser.parse_args() |
|
|
| if not hasattr(args, "func"): |
| parser.print_help() |
| exit(1) |
|
|
| |
| args.func(args) |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|