Skip to content

Commit

Permalink
Use GPU CLI argument
Browse files Browse the repository at this point in the history
- Disabling GPU for Tensorflow as default

- Change log level to INFO
  • Loading branch information
Igorxp5 committed Nov 26, 2020
1 parent 24aa2f2 commit 7097759
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion training.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import random
import logging
import argparse
Expand Down Expand Up @@ -353,13 +354,20 @@ def training(board_size, num_iterations, num_episodes, num_simulations, degree_e

parser.add_argument('-o', '--output-file', default=DEFAULT_CHECKPOINT_FILEPATH, help='File path to save neural network weights')
parser.add_argument('-w', '--weights-file', default=None, help='File path to load neural network weights')
parser.add_argument('-l', '--log-level', default='DEBUG', choices=('INFO', 'DEBUG', 'WARNING', 'ERROR'), help='Logging level')
parser.add_argument('-l', '--log-level', default='INFO', choices=('INFO', 'DEBUG', 'WARNING', 'ERROR'), help='Logging level')
parser.add_argument('-t', '--temperature', default=1, type=int, help='Policy temperature parameter')
parser.add_argument('-tt', '--temperature-threshold', default=25, type=int, help='Number of iterations using the temperature '
'parameter before changing to 0')

parser.add_argument('-ug', '--use-gpu', default=False, action='store_true', help='Enable GPU for Tensorflow')

args = parser.parse_args()

if not args.use_gpu:
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'

from Net.NNet import NNetWrapper

assert args.victory_threshold <= args.total_games, '"victory-threshold" must be less than "total-games"'

logging.basicConfig(level=getattr(logging, args.log_level, None), format=LOG_FORMAT)
Expand Down

0 comments on commit 7097759

Please sign in to comment.