diff --git a/a2c_ppo_acktr/arguments.py b/a2c_ppo_acktr/arguments.py index 0a6e70c39..315a11bd3 100644 --- a/a2c_ppo_acktr/arguments.py +++ b/a2c_ppo_acktr/arguments.py @@ -149,6 +149,12 @@ def get_args(): action='store_true', default=False, help='use a linear schedule on the learning rate') + parser.add_argument( + '--disable-fork-safety', + action='store_true', + default=False, + help='Add an environment variable to prevent occasional ' + 'conflict with macOS fork safety') args = parser.parse_args() args.cuda = not args.no_cuda and torch.cuda.is_available() diff --git a/main.py b/main.py index 49abb59c0..6d6be45df 100755 --- a/main.py +++ b/main.py @@ -22,7 +22,8 @@ def main(): args = get_args() - + if args.disable_fork_safety: + os.environ['OBJC_DISABLE_INITIALIZE_FORK_SAFETY'] = 'YES' torch.manual_seed(args.seed) torch.cuda.manual_seed_all(args.seed)