Commit 104949c3 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko
Browse files

Merge branch 'develop' into 'master'

Adjustments for BLEU eval_metric. Updated dependencies

See merge request !42
parents 93d0199d 5af5df86
Pipeline #215570 passed with stages
in 6 minutes and 8 seconds
...@@ -9,16 +9,16 @@ ...@@ -9,16 +9,16 @@
<groupId>de.monticore.lang.monticar</groupId> <groupId>de.monticore.lang.monticar</groupId>
<artifactId>cnnarch-caffe2-generator</artifactId> <artifactId>cnnarch-caffe2-generator</artifactId>
<version>0.2.13-SNAPSHOT</version> <version>0.2.14-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= --> <!-- == PROJECT DEPENDENCIES ============================================= -->
<properties> <properties>
<!-- .. SE-Libraries .................................................. --> <!-- .. SE-Libraries .................................................. -->
<CNNArch.version>0.3.2-SNAPSHOT</CNNArch.version> <CNNArch.version>0.3.4-SNAPSHOT</CNNArch.version>
<CNNTrain.version>0.3.6-SNAPSHOT</CNNTrain.version> <CNNTrain.version>0.3.9-SNAPSHOT</CNNTrain.version>
<CNNArch2X.version>0.0.3-SNAPSHOT</CNNArch2X.version> <CNNArch2X.version>0.0.5-SNAPSHOT</CNNArch2X.version>
<embedded-montiarc-math-opt-generator>0.1.4</embedded-montiarc-math-opt-generator> <embedded-montiarc-math-opt-generator>0.1.4</embedded-montiarc-math-opt-generator>
<!-- .. Libraries .................................................. --> <!-- .. Libraries .................................................. -->
......
...@@ -141,7 +141,7 @@ public class CNNArchTemplateController { ...@@ -141,7 +141,7 @@ public class CNNArchTemplateController {
include(TEMPLATE_ELEMENTS_DIR_PATH, "Output", writer); include(TEMPLATE_ELEMENTS_DIR_PATH, "Output", writer);
} }
} else { } else {
include(element.getResolvedThis().get(), writer); include((ArchitectureElementSymbol) element.getResolvedThis().get(), writer);
} }
setCurrentElement(previousElement); setCurrentElement(previousElement);
...@@ -158,7 +158,7 @@ public class CNNArchTemplateController { ...@@ -158,7 +158,7 @@ public class CNNArchTemplateController {
include(TEMPLATE_ELEMENTS_DIR_PATH, templateName, writer); include(TEMPLATE_ELEMENTS_DIR_PATH, templateName, writer);
} }
} else { } else {
include(layer.getResolvedThis().get(), writer); include((ArchitectureElementSymbol) layer.getResolvedThis().get(), writer);
} }
setCurrentElement(previousElement); setCurrentElement(previousElement);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
package de.monticore.lang.monticar.cnnarch.caffe2generator; package de.monticore.lang.monticar.cnnarch.caffe2generator;
import de.monticore.lang.monticar.cnntrain._symboltable.*; import de.monticore.lang.monticar.cnntrain._symboltable.*;
import static de.monticore.lang.monticar.cnntrain.helper.ConfigEntryNameConstants.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -61,11 +62,8 @@ public class ConfigurationData { ...@@ -61,11 +62,8 @@ public class ConfigurationData {
return getConfiguration().getEntry("context").getValue().toString(); return getConfiguration().getEntry("context").getValue().toString();
} }
public String getEvalMetric() { public Map<String, Object> getEvalMetric() {
if (!getConfiguration().getEntryMap().containsKey("eval_metric")) { return getMultiParamEntry(EVAL_METRIC, "name");
return null;
}
return getConfiguration().getEntry("eval_metric").getValue().toString();
} }
public String getLoss() { public String getLoss() {
...@@ -104,4 +102,29 @@ public class ConfigurationData { ...@@ -104,4 +102,29 @@ public class ConfigurationData {
} }
return mapToStrings; return mapToStrings;
} }
protected Map<String, Object> getMultiParamEntry(final String key, final String valueName) {
if (!configurationContainsKey(key)) {
return null;
}
Map<String, Object> resultView = new HashMap<>();
ValueSymbol value = this.getConfiguration().getEntryMap().get(key).getValue();
if (value instanceof MultiParamValueSymbol) {
MultiParamValueSymbol multiParamValue = (MultiParamValueSymbol) value;
resultView.put(valueName, multiParamValue.getValue());
resultView.putAll(multiParamValue.getParameters());
}
else {
resultView.put(valueName, value.getValue());
}
return resultView;
}
protected Boolean configurationContainsKey(final String key) {
return this.getConfiguration().getEntryMap().containsKey(key);
}
} }
...@@ -28,7 +28,7 @@ if __name__ == "__main__": ...@@ -28,7 +28,7 @@ if __name__ == "__main__":
context='${config.context}', context='${config.context}',
</#if> </#if>
<#if (config.evalMetric)??> <#if (config.evalMetric)??>
eval_metric='${config.evalMetric}', eval_metric='${config.evalMetric.name}',
</#if> </#if>
<#if (config.loss)??> <#if (config.loss)??>
loss='${config.loss}', loss='${config.loss}',
......
#(c) https://github.com/MontiCore/monticore
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
......
# (c) https://github.com/MontiCore/monticore
from caffe2.python import workspace, core, model_helper, brew, optimizer from caffe2.python import workspace, core, model_helper, brew, optimizer
from caffe2.python.predictor import mobile_exporter from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2 from caffe2.proto import caffe2_pb2
...@@ -92,6 +91,7 @@ class CNNCreator_LeNet: ...@@ -92,6 +91,7 @@ class CNNCreator_LeNet:
return predictions_ return predictions_
# this adds the loss and optimizer # this adds the loss and optimizer
def add_training_operators(self, model, output, label, device_opts, loss, opt_type, base_learning_rate, policy, stepsize, epsilon, beta1, beta2, gamma, momentum) : def add_training_operators(self, model, output, label, device_opts, loss, opt_type, base_learning_rate, policy, stepsize, epsilon, beta1, beta2, gamma, momentum) :
with core.DeviceScope(device_opts): with core.DeviceScope(device_opts):
......
# (c) https://github.com/MontiCore/monticore
from caffe2.python import workspace, core, model_helper, brew, optimizer from caffe2.python import workspace, core, model_helper, brew, optimizer
from caffe2.python.predictor import mobile_exporter from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2 from caffe2.proto import caffe2_pb2
...@@ -138,6 +137,7 @@ class CNNCreator_VGG16: ...@@ -138,6 +137,7 @@ class CNNCreator_VGG16:
return predictions_ return predictions_
# this adds the loss and optimizer # this adds the loss and optimizer
def add_training_operators(self, model, output, label, device_opts, loss, opt_type, base_learning_rate, policy, stepsize, epsilon, beta1, beta2, gamma, momentum) : def add_training_operators(self, model, output, label, device_opts, loss, opt_type, base_learning_rate, policy, stepsize, epsilon, beta1, beta2, gamma, momentum) :
with core.DeviceScope(device_opts): with core.DeviceScope(device_opts):
......
/* (c) https://github.com/MontiCore/monticore */
#ifndef CNNPREDICTOR_LENET #ifndef CNNPREDICTOR_LENET
#define CNNPREDICTOR_LENET #define CNNPREDICTOR_LENET
......
/* (c) https://github.com/MontiCore/monticore */
#ifndef CNNPREDICTOR_VGG16 #ifndef CNNPREDICTOR_VGG16
#define CNNPREDICTOR_VGG16 #define CNNPREDICTOR_VGG16
......
# (c) https://github.com/MontiCore/monticore
from caffe2.python import workspace, core, model_helper, brew, optimizer from caffe2.python import workspace, core, model_helper, brew, optimizer
from caffe2.python.predictor import mobile_exporter from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2 from caffe2.proto import caffe2_pb2
......
# (c) https://github.com/MontiCore/monticore
from caffe2.python import workspace, core, model_helper, brew, optimizer from caffe2.python import workspace, core, model_helper, brew, optimizer
from caffe2.python.predictor import mobile_exporter from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2 from caffe2.proto import caffe2_pb2
......
# (c) https://github.com/MontiCore/monticore
from caffe2.python import workspace, core, model_helper, brew, optimizer from caffe2.python import workspace, core, model_helper, brew, optimizer
from caffe2.python.predictor import mobile_exporter from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2 from caffe2.proto import caffe2_pb2
......
# (c) https://github.com/MontiCore/monticore
from caffe2.python import workspace, core, model_helper, brew, optimizer from caffe2.python import workspace, core, model_helper, brew, optimizer
from caffe2.python.predictor import mobile_exporter from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2 from caffe2.proto import caffe2_pb2
......
# (c) https://github.com/MontiCore/monticore
# Automatically generated file # Automatically generated file
# #
# - Try to find Armadillo # - Try to find Armadillo
...@@ -36,4 +35,4 @@ mark_as_advanced( ...@@ -36,4 +35,4 @@ mark_as_advanced(
) )
set(Armadillo_INCLUDE_DIRS ${Armadillo_INCLUDE_DIR}) set(Armadillo_INCLUDE_DIRS ${Armadillo_INCLUDE_DIR})
set(Armadillo_LIBRARIES ${Armadillo_LIBRARY}) set(Armadillo_LIBRARIES ${Armadillo_LIBRARY})
\ No newline at end of file
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