Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ private void loadModel(Path path) {
ConfigManager.getInstance().getConfig().neuralNetworkPropertyManager().getModel(path);

if (properties == null) {
logger.error(
logger.warn(
"Model properties are null. This could mean the config for model "
+ path
+ " was unable to be found in the database. Trying legacy...");
Expand All @@ -334,8 +334,9 @@ private void loadModel(Path path) {
.getConfig()
.neuralNetworkPropertyManager()
.addModelProperties(properties);
} catch (IllegalArgumentException | IOException e) {
} catch (Exception e) {
Comment thread
mcm001 marked this conversation as resolved.
Outdated
logger.error("Failed to translate legacy model filename to properties: " + path, e);
return;
Comment thread
mcm001 marked this conversation as resolved.
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -92,8 +94,12 @@ static ModelProperties createFromFilename(String modelFileName)
throw new IllegalArgumentException("Model " + modelFileName + " cannot find backend");
}

String labelFile = model.getAbsolutePath().replace(backend.get().extension(), "-labels.txt");
List<String> labels = Files.readAllLines(Paths.get(labelFile));
String labelFilename = model.getAbsolutePath().replace(backend.get().extension(), "-labels.txt");
var labelPath = Path.of(labelFilename);
if (!labelPath.toFile().exists()) {
throw new FileNotFoundException("Label file " + labelFilename + " does not exist");
}
List<String> labels = Files.readAllLines(labelPath);

String[] parts = parseRKNNName(modelFileName);
var version = getModelVersion(parts[3]);
Expand Down
Loading