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__':
\ 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':
if arguments.settings_path is not None:
settings_evaluation = Settings(arguments.settings_path)
settings_evaluation = Settings('settings_evaluation.ini')
mapping_evaluation_parameters = settings_evaluation['MAPPING']
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':
print('Cleared the current experiments and logs directory successfully!')
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