prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Mismatch between `accelerate config` cli and  `default_config.yaml`
  The generated `default_config.yaml` is mismatch with `accelerate config`.
  
  Here are my cli outputs and `default_config.yaml`
  
  cli outputs
  
  ```
  In which compute environment are you running? ([0] This machine, [1] AWS (Amazon SageMaker)): 0
  Which type of machine are you using? ([0] No distributed training, [1] multi-GPU, [2] TPU): 1
  How many different machines will you use (use more than 1 for multi-node training)? [1]: 2
  What is the rank of this machine (from 0 to the number of machines - 1 )? [0]: 1
  What is the IP address of the machine that will host the main process? 10.29.150.50
  What is the port you will use to communicate with the main process? 2333
  How many processes in total will you use? [1]: 6
  Do you wish to use FP16 (mixed precision)? [yes/NO]: yes
  
  ```
  
  `default_config.yaml`
  ```
  compute_environment: LOCAL_MACHINE
  distributed_type: MULTI_GPU
  fp16: true
  machine_rank: 1
  main_process_ip: 2333
  main_process_port: null
  main_training_function: main
  num_machines: 2
  num_processes: 6
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/accelerate/commands/config/cluster.py`
  Content:
  ```
  1 #!/usr/bin/env python
  2 
  3 # Copyright 2021 The HuggingFace Team. All rights reserved.
  4 #
  5 # Licensed under the Apache License, Version 2.0 (the "License");
  6 # you may not use this file except in compliance with the License.
  7 # You may obtain a copy of the License at
  8 #
  9 #     http://www.apache.org/licenses/LICENSE-2.0
  10 #
  11 # Unless required by applicable law or agreed to in writing, software
  12 # distributed under the License is distributed on an "AS IS" BASIS,
  13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14 # See the License for the specific language governing permissions and
  15 # limitations under the License.
  16 
  17 from accelerate.state import ComputeEnvironment, DistributedType
  18 
  19 from .config_args import ClusterConfig
  20 from .config_utils import _ask_field, _convert_distributed_mode, _convert_yes_no_to_bool
  21 
  22 
  23 def get_cluster_input():
  24     distributed_type = _ask_field(
  25         "Which type of machine are you using? ([0] No distributed training, [1] multi-GPU, [2] TPU): ",
  26         _convert_distributed_mode,
  27         error_message="Please enter 0, 1 or 2.",
  28     )
  29 
  30     machine_rank = 0
  31     num_machines = 1
  32     main_process_ip = None
  33     main_process_port = None
  34     if distributed_type == DistributedType.MULTI_GPU:
  35         num_machines = _ask_field(
  36             "How many different machines will you use (use more than 1 for multi-node training)? [1]: ",
  37             lambda x: int(x),
  38             default=1,
  39         )
  40         if num_machines > 1:
  41             machine_rank = _ask_field(
  42                 "What is the rank of this machine (from 0 to the number of machines - 1 )? [0]: ",
  43                 lambda x: int(x),
  44                 default=0,
  45             )
  46             main_process_ip = _ask_field(
  47                 "What is the IP address of the machine that will host the main process? ",
  48             )
  49             main_process_ip = _ask_field(
  50                 "What is the port you will use to communicate with the main process? ",
  51                 lambda x: int(x),
  52             )
  53     if distributed_type == DistributedType.TPU:
  54         main_training_function = _ask_field(
  55             "What is the name of the function in your script that should be launched in all parallel scripts? [main]: ",
  56             default="main",
  57         )
  58     else:
  59         main_training_function = "main"
  60 
  61     num_processes = _ask_field(
  62         "How many processes in total will you use? [1]: ",
  63         lambda x: int(x),
  64         default=1,
  65         error_message="Please enter an integer.",
  66     )
  67 
  68     if distributed_type != DistributedType.TPU:
  69         fp16 = _ask_field(
  70             "Do you wish to use FP16 (mixed precision)? [yes/NO]: ",
  71             _convert_yes_no_to_bool,
  72             default=False,
  73             error_message="Please enter yes or no.",
  74         )
  75     else:
  76         fp16 = False
  77 
  78     return ClusterConfig(
  79         compute_environment=ComputeEnvironment.LOCAL_MACHINE,
  80         distributed_type=distributed_type,
  81         num_processes=num_processes,
  82         fp16=fp16,
  83         machine_rank=machine_rank,
  84         num_machines=num_machines,
  85         main_process_ip=main_process_ip,
  86         main_process_port=main_process_port,
  87         main_training_function=main_training_function,
  88     )
  89
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/src/accelerate/commands/config/cluster.py b/src/accelerate/commands/config/cluster.py
  --- a/src/accelerate/commands/config/cluster.py
  +++ b/src/accelerate/commands/config/cluster.py
  @@ -46,7 +46,7 @@
               main_process_ip = _ask_field(
                   "What is the IP address of the machine that will host the main process? ",
               )
  -            main_process_ip = _ask_field(
  +            main_process_port = _ask_field(
                   "What is the port you will use to communicate with the main process? ",
                   lambda x: int(x),
               )
  
verification_info: {"golden_diff": "diff --git a/src/accelerate/commands/config/cluster.py b/src/accelerate/commands/config/cluster.py\n--- a/src/accelerate/commands/config/cluster.py\n+++ b/src/accelerate/commands/config/cluster.py\n@@ -46,7 +46,7 @@\n             main_process_ip = _ask_field(\n                 \"What is the IP address of the machine that will host the main process? \",\n             )\n-            main_process_ip = _ask_field(\n+            main_process_port = _ask_field(\n                 \"What is the port you will use to communicate with the main process? \",\n                 lambda x: int(x),\n             )\n", "issue": "Mismatch between `accelerate config` cli and  `default_config.yaml`\nThe generated `default_config.yaml` is mismatch with `accelerate config`.\r\n\r\nHere are my cli outputs and `default_config.yaml`\r\n\r\ncli outputs\r\n\r\n```\r\nIn which compute environment are you running? ([0] This machine, [1] AWS (Amazon SageMaker)): 0\r\nWhich type of machine are you using? ([0] No distributed training, [1] multi-GPU, [2] TPU): 1\r\nHow many different machines will you use (use more than 1 for multi-node training)? [1]: 2\r\nWhat is the rank of this machine (from 0 to the number of machines - 1 )? [0]: 1\r\nWhat is the IP address of the machine that will host the main process? 10.29.150.50\r\nWhat is the port you will use to communicate with the main process? 2333\r\nHow many processes in total will you use? [1]: 6\r\nDo you wish to use FP16 (mixed precision)? [yes/NO]: yes\r\n\r\n```\r\n\r\n`default_config.yaml`\r\n```\r\ncompute_environment: LOCAL_MACHINE\r\ndistributed_type: MULTI_GPU\r\nfp16: true\r\nmachine_rank: 1\r\nmain_process_ip: 2333\r\nmain_process_port: null\r\nmain_training_function: main\r\nnum_machines: 2\r\nnum_processes: 6\r\n```\r\n\n", "before_files": [{"content": "#!/usr/bin/env python\n\n# Copyright 2021 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom accelerate.state import ComputeEnvironment, DistributedType\n\nfrom .config_args import ClusterConfig\nfrom .config_utils import _ask_field, _convert_distributed_mode, _convert_yes_no_to_bool\n\n\ndef get_cluster_input():\n    distributed_type = _ask_field(\n        \"Which type of machine are you using? ([0] No distributed training, [1] multi-GPU, [2] TPU): \",\n        _convert_distributed_mode,\n        error_message=\"Please enter 0, 1 or 2.\",\n    )\n\n    machine_rank = 0\n    num_machines = 1\n    main_process_ip = None\n    main_process_port = None\n    if distributed_type == DistributedType.MULTI_GPU:\n        num_machines = _ask_field(\n            \"How many different machines will you use (use more than 1 for multi-node training)? [1]: \",\n            lambda x: int(x),\n            default=1,\n        )\n        if num_machines > 1:\n            machine_rank = _ask_field(\n                \"What is the rank of this machine (from 0 to the number of machines - 1 )? [0]: \",\n                lambda x: int(x),\n                default=0,\n            )\n            main_process_ip = _ask_field(\n                \"What is the IP address of the machine that will host the main process? \",\n            )\n            main_process_ip = _ask_field(\n                \"What is the port you will use to communicate with the main process? \",\n                lambda x: int(x),\n            )\n    if distributed_type == DistributedType.TPU:\n        main_training_function = _ask_field(\n            \"What is the name of the function in your script that should be launched in all parallel scripts? [main]: \",\n            default=\"main\",\n        )\n    else:\n        main_training_function = \"main\"\n\n    num_processes = _ask_field(\n        \"How many processes in total will you use? [1]: \",\n        lambda x: int(x),\n        default=1,\n        error_message=\"Please enter an integer.\",\n    )\n\n    if distributed_type != DistributedType.TPU:\n        fp16 = _ask_field(\n            \"Do you wish to use FP16 (mixed precision)? [yes/NO]: \",\n            _convert_yes_no_to_bool,\n            default=False,\n            error_message=\"Please enter yes or no.\",\n        )\n    else:\n        fp16 = False\n\n    return ClusterConfig(\n        compute_environment=ComputeEnvironment.LOCAL_MACHINE,\n        distributed_type=distributed_type,\n        num_processes=num_processes,\n        fp16=fp16,\n        machine_rank=machine_rank,\n        num_machines=num_machines,\n        main_process_ip=main_process_ip,\n        main_process_port=main_process_port,\n        main_training_function=main_training_function,\n    )\n", "path": "src/accelerate/commands/config/cluster.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\n# Copyright 2021 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom accelerate.state import ComputeEnvironment, DistributedType\n\nfrom .config_args import ClusterConfig\nfrom .config_utils import _ask_field, _convert_distributed_mode, _convert_yes_no_to_bool\n\n\ndef get_cluster_input():\n    distributed_type = _ask_field(\n        \"Which type of machine are you using? ([0] No distributed training, [1] multi-GPU, [2] TPU): \",\n        _convert_distributed_mode,\n        error_message=\"Please enter 0, 1 or 2.\",\n    )\n\n    machine_rank = 0\n    num_machines = 1\n    main_process_ip = None\n    main_process_port = None\n    if distributed_type == DistributedType.MULTI_GPU:\n        num_machines = _ask_field(\n            \"How many different machines will you use (use more than 1 for multi-node training)? [1]: \",\n            lambda x: int(x),\n            default=1,\n        )\n        if num_machines > 1:\n            machine_rank = _ask_field(\n                \"What is the rank of this machine (from 0 to the number of machines - 1 )? [0]: \",\n                lambda x: int(x),\n                default=0,\n            )\n            main_process_ip = _ask_field(\n                \"What is the IP address of the machine that will host the main process? \",\n            )\n            main_process_port = _ask_field(\n                \"What is the port you will use to communicate with the main process? \",\n                lambda x: int(x),\n            )\n    if distributed_type == DistributedType.TPU:\n        main_training_function = _ask_field(\n            \"What is the name of the function in your script that should be launched in all parallel scripts? [main]: \",\n            default=\"main\",\n        )\n    else:\n        main_training_function = \"main\"\n\n    num_processes = _ask_field(\n        \"How many processes in total will you use? [1]: \",\n        lambda x: int(x),\n        default=1,\n        error_message=\"Please enter an integer.\",\n    )\n\n    if distributed_type != DistributedType.TPU:\n        fp16 = _ask_field(\n            \"Do you wish to use FP16 (mixed precision)? [yes/NO]: \",\n            _convert_yes_no_to_bool,\n            default=False,\n            error_message=\"Please enter yes or no.\",\n        )\n    else:\n        fp16 = False\n\n    return ClusterConfig(\n        compute_environment=ComputeEnvironment.LOCAL_MACHINE,\n        distributed_type=distributed_type,\n        num_processes=num_processes,\n        fp16=fp16,\n        machine_rank=machine_rank,\n        num_machines=num_machines,\n        main_process_ip=main_process_ip,\n        main_process_port=main_process_port,\n        main_training_function=main_training_function,\n    )\n", "path": "src/accelerate/commands/config/cluster.py"}]}