Commit 23eb5106 authored by Svetlana Pavlitskaya's avatar Svetlana Pavlitskaya

Minor cosmetic changes to CNNTrainer template

parent cf167f6b
Pipeline #69491 passed with stages
in 1 minute and 43 seconds
......@@ -7,37 +7,37 @@ import CNNCreator_${config.instanceName}
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()
handler = logging.FileHandler("train.log","w", encoding=None, delay="true")
handler = logging.FileHandler("train.log", "w", encoding=None, delay="true")
logger.addHandler(handler)
<#list configurations as config>
${config.instanceName} = CNNCreator_${config.instanceName}.CNNCreator_${config.instanceName}()
${config.instanceName}.train(
<#if (config.batchSize)??>
batch_size = ${config.batchSize},
batch_size=${config.batchSize},
</#if>
<#if (config.numEpoch)??>
num_epoch = ${config.numEpoch},
num_epoch=${config.numEpoch},
</#if>
<#if (config.loadCheckpoint)??>
load_checkpoint = ${config.loadCheckpoint?string("True","False")},
load_checkpoint=${config.loadCheckpoint?string("True","False")},
</#if>
<#if (config.context)??>
context = '${config.context}',
context='${config.context}',
</#if>
<#if (config.normalize)??>
normalize = ${config.normalize?string("True","False")},
normalize=${config.normalize?string("True","False")},
</#if>
<#if (config.evalMetric)??>
eval_metric = '${config.evalMetric}',
eval_metric='${config.evalMetric}',
</#if>
<#if (config.configuration.optimizer)??>
optimizer = '${config.optimizerName}',
optimizer_params = {
optimizer='${config.optimizerName}',
optimizer_params={
<#list config.optimizerParams?keys as param>
'${param}': ${config.optimizerParams[param]}<#sep>,
</#list>
}
}
</#if>
)
</#list>
\ No newline at end of file
......@@ -6,34 +6,34 @@ import CNNCreator_main_net2
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()
handler = logging.FileHandler("train.log","w", encoding=None, delay="true")
handler = logging.FileHandler("train.log", "w", encoding=None, delay="true")
logger.addHandler(handler)
main_net1 = CNNCreator_main_net1.CNNCreator_main_net1()
main_net1.train(
batch_size = 64,
num_epoch = 10,
load_checkpoint = False,
context = 'gpu',
normalize = True,
optimizer = 'adam',
optimizer_params = {
batch_size=64,
num_epoch=10,
load_checkpoint=False,
context='gpu',
normalize=True,
optimizer='adam',
optimizer_params={
'weight_decay': 1.0E-4,
'learning_rate': 0.01,
'learning_rate_decay': 0.8,
'step_size': 1000 }
'step_size': 1000}
)
main_net2 = CNNCreator_main_net2.CNNCreator_main_net2()
main_net2.train(
batch_size = 32,
num_epoch = 10,
load_checkpoint = False,
context = 'gpu',
normalize = True,
optimizer = 'adam',
optimizer_params = {
batch_size=32,
num_epoch=10,
load_checkpoint=False,
context='gpu',
normalize=True,
optimizer='adam',
optimizer_params={
'weight_decay': 1.0E-4,
'learning_rate': 0.01,
'learning_rate_decay': 0.8,
'step_size': 1000 }
'step_size': 1000}
)
......@@ -5,7 +5,7 @@ import CNNCreator_main_net1
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()
handler = logging.FileHandler("train.log","w", encoding=None, delay="true")
handler = logging.FileHandler("train.log", "w", encoding=None, delay="true")
logger.addHandler(handler)
main_net1 = CNNCreator_main_net1.CNNCreator_main_net1()
......
......@@ -6,19 +6,19 @@ import CNNCreator_main_net2
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()
handler = logging.FileHandler("train.log","w", encoding=None, delay="true")
handler = logging.FileHandler("train.log", "w", encoding=None, delay="true")
logger.addHandler(handler)
main_net1 = CNNCreator_main_net1.CNNCreator_main_net1()
main_net1.train(
batch_size = 100,
num_epoch = 5,
load_checkpoint = True,
context = 'gpu',
normalize = True,
eval_metric = 'mse',
optimizer = 'rmsprop',
optimizer_params = {
batch_size=100,
num_epoch=5,
load_checkpoint=True,
context='gpu',
normalize=True,
eval_metric='mse',
optimizer='rmsprop',
optimizer_params={
'weight_decay': 0.01,
'centered': True,
'gamma2': 0.9,
......@@ -31,18 +31,18 @@ if __name__ == "__main__":
'learning_rate_minimum': 1.0E-5,
'learning_rate_policy': 'step',
'learning_rate': 0.001,
'step_size': 1000 }
'step_size': 1000}
)
main_net2 = CNNCreator_main_net2.CNNCreator_main_net2()
main_net2.train(
batch_size = 100,
num_epoch = 10,
load_checkpoint = False,
context = 'gpu',
normalize = False,
eval_metric = 'topKAccuracy',
optimizer = 'adam',
optimizer_params = {
batch_size=100,
num_epoch=10,
load_checkpoint=False,
context='gpu',
normalize=False,
eval_metric='topKAccuracy',
optimizer='adam',
optimizer_params={
'epsilon': 1.0E-6,
'weight_decay': 0.01,
'rescale_grad': 1.1,
......@@ -53,5 +53,5 @@ if __name__ == "__main__":
'learning_rate_policy': 'exp',
'learning_rate': 0.001,
'learning_rate_decay': 0.9,
'step_size': 1000 }
'step_size': 1000}
)
......@@ -6,22 +6,22 @@ import CNNCreator_main_net2
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()
handler = logging.FileHandler("train.log","w", encoding=None, delay="true")
handler = logging.FileHandler("train.log", "w", encoding=None, delay="true")
logger.addHandler(handler)
main_net1 = CNNCreator_main_net1.CNNCreator_main_net1()
main_net1.train(
batch_size = 100,
num_epoch = 50,
optimizer = 'adam',
optimizer_params = {
'learning_rate': 0.001 }
batch_size=100,
num_epoch=50,
optimizer='adam',
optimizer_params={
'learning_rate': 0.001}
)
main_net2 = CNNCreator_main_net2.CNNCreator_main_net2()
main_net2.train(
batch_size = 100,
num_epoch = 5,
optimizer = 'sgd',
optimizer_params = {
'learning_rate': 0.1 }
batch_size=100,
num_epoch=5,
optimizer='sgd',
optimizer_params={
'learning_rate': 0.1}
)
Markdown is supported
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