Schema validation fails when root model is not called 'MnistClassifier' (PyTorch Backend)
Remark
The training configuration of a network must be named <componentName>_<networkInstanceName>
(where componentName
is the name of the component containing the network instance, and networkInstanceName
is the name of the network instance inside that component). For example, the training configuration of the network in 'adanet_experiment' must be named mnistClassifier_net
, since the component containing the network is called 'MnistClassifier' and the instance name is 'net'. If the configuration name does not follow that pattern, executing the generated Python script will fail.
Problem
During schema validation, the name of the configuration is checked for hardcoded values (see de.monticore.mlpipelines.automl.helper.ConfigurationValidationHandler.getScmName()
). This means, that schema validation only succeeds if the name of the configuration is 'Supervised' or starts with 'mnistClassifier'. The first option is not viable, as the name must follow the pattern from above (see remark). Therefore, the configuration must be named mnistClassifier_<networkInstanceName>
, which consequently means that the root emadl model must be called 'MnistClassifier' or 'mnistClassifier'. Executing the EMADL2CPP generator on other models will therefore fail.
Steps to reproduce
Execute the generator on an architecture, whose root model is not called 'MnistClassifier' or 'mnistClassifier'. Example execution:
- Main class:
de.monticore.lang.monticar.emadl.generator.MontiAnnaCli
- Program arguments:
-m src/main/resources/calculator_experiment/emadl -r calculator.Connector -o target -b PYTORCH
Workaround
Until this issue is fixed, the method getScmName()
(see above) must be modified to allow schema validation for configurations with custom names. To allow the execution above, the method must be modified as follows:
private static String getScmName(ASTConfiguration configuration) {
String scmName = configuration.getName();
if (scmName.startsWith("mnistClassifier") || scmName.startsWith("connector")) {
scmName = "Supervised";
} else if (scmName.equals("AdaNet")) {
scmName = "NeuralArchitectureSearch";
}
return scmName;
}