Commit 000ef532 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko

Merge branch 'develop' into 'master'

Develop

See merge request !10
parents 44088e98 30a2400e
Pipeline #267730 passed with stage
in 2 minutes and 28 seconds
......@@ -14,6 +14,7 @@ import de.se_rwth.commons.logging.Log;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
......@@ -74,9 +75,15 @@ public abstract class CNNArchGenerator {
DataPathConfigParser dataParserConfig = new DataPathConfigParser(dataConfPath);
String dataPath = dataParserConfig.getDataPath(rootModelName);
architectureSymbol.setDataPath(dataPath);
String weightsConfPath = getModelsDirPath() + "/weights_paths.txt";
WeightsPathConfigParser weightsParserConfig = new WeightsPathConfigParser(weightsConfPath);
String weightsPath = weightsParserConfig.getWeightsPath(rootModelName);
Path weightsConfPath = Paths.get(getModelsDirPath() + "/weights_paths.txt");
String weightsPath = null;
if (weightsConfPath.toFile().exists()) {
WeightsPathConfigParser weightsParserConfig = new WeightsPathConfigParser(getModelsDirPath() + "/weights_paths.txt");
weightsPath = weightsParserConfig.getWeightsPath(rootModelName);
} else {
Log.info("No weights path definition found in " + weightsConfPath + " found: "
+ "No pretrained weights will be loaded.", "CNNArchGenerator");
}
architectureSymbol.setWeightsPath(weightsPath);
architectureSymbol.setComponentName(rootModelName);
generateFiles(architectureSymbol);
......
......@@ -37,7 +37,7 @@ public class WeightsPathConfigParser{
public String getWeightsPath(String modelName) {
String path = properties.getProperty(modelName);
if(path == null) {
Log.warn("Weights path config file did not specify a path for component '" + modelName + "'");
Log.info("Weights path config file did not specify a path for component '" + modelName + "'", "WeightsPathConfigParser");
return path;
}
return path;
......
......@@ -29,15 +29,6 @@ public class WeightsPathConfigParserTest extends AbstractSymtabTest {
assertTrue("Wrong weights path returned", weights_path.equals("/path/to/training/weights"));
}
@Test
public void testWeightsPathConfigParserInvalidComponent() {
WeightsPathConfigParser parser = new WeightsPathConfigParser("src/test/resources/architectures/weights_paths.txt");
String weights_path = parser.getWeightsPath("NotExistingComponent");
assertTrue("For not listed components, null should be returned", weights_path == null);
assertTrue(Log.getFindings().size() == 1);
}
@Test
public void testWeightsPathConfigParserInvalidPath() {
WeightsPathConfigParser parser = new WeightsPathConfigParser("invalid/path/weights_paths.txt");
......
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