Commit 17a0a5d9 authored by Andrei-Claudiu Roibu's avatar Andrei-Claudiu Roibu 🖥
Browse files

added commands required for running the main

parent 987c425f
......@@ -27,6 +27,9 @@ import os
from utils.data_logging_utils import LogWriter
import utils.data_evaluation_utils as evaluations
import shutil
import argparse
from settings import Settings
import logging
# Set the default floating point tensor type to FloatTensor
......@@ -392,4 +395,38 @@ def delete_files():
if __name__ == '__main__':
pass
\ No newline at end of file
parser = argparse.ArgumentParser()
parser.add_argument('--mode', '-m', required= True, help= 'run mode, valid values are train or evaluate')
parser.add_argument('--settings_path', '-sp', required= False, help='optional argument, set path to settings_evaluation.ini')
arguments = parser.parse_args()
settings = Settings('settings.ini')
data_parameters = settings['DATA']
training_parameters = settings['TRAINING']
network_parameters = settings['NETWORK']
misc_parameters = settings['MISC']
evaluation_parameters = settings['EVALUATION']
if arguments.mode == 'train':
train(data_parameters, training_parameters, network_parameters, misc_parameters)
elif arguments.mode == 'evaluate-score':
evaluate_score(data_parameters, training_parameters, network_parameters, misc_parameters, evaluation_parameters)
elif arguments.mode == 'evaluate-mapping':
logging.basicConfig(filename='evaluate-mapping-error.log')
if arguments.settings_path is not None:
settings_evaluation = Settings(arguments.settings_path)
else:
settings_evaluation = Settings('settings_evaluation.ini')
mapping_evaluation_parameters = settings_evaluation['MAPPING']
evaluate_score(mapping_evaluation_parameters)
elif arguments.mode == 'clear-experiments':
shutil.rmtree(os.path.join(misc_parameters['experiments_directory'], training_parameters['experiment_name']))
shutil.rmtree(os.path.join(misc_parameters['logs_directory'], training_parameters['experiment_name']))
print('Cleared the current experiments and logs directory successfully!')
elif arguments.mode == 'clear-everything':
delete_files(misc_parameters['experiments_directory'])
delete_files(misc_parameters['logs_directory'])
print('Cleared the current experiments and logs directory successfully!')
else:
raise ValueError('Invalid mode value! Only supports: train, evaluate-score, evaluate-mapping, clear-experiments and clear-everything')
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment