aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 210db7e..8718a66 100644
--- a/src/main.c
+++ b/src/main.c
@@ -194,6 +194,7 @@ struct Cost load_loss(struct Configs cfg)
}
int main(int argc, char *argv[]) {
+ char default_config_path[512];
struct Configs ml_configs = {
.epochs = 100,
.alpha = 1e-5,
@@ -202,11 +203,18 @@ int main(int argc, char *argv[]) {
.out_filepath = NULL,
};
- // Try different config paths
- load_config(&ml_configs, 3, "~/.config/ml/ml.cfg", "~/.ml/ml.cfg", ml_configs.config_filepath);
+ // First past to check if --config option was put
+ util_load_cli(&ml_configs, argc, argv);
+ optind = 1;
+ // Load configs with different possible paths
+ sprintf(default_config_path, "%s/%s", getenv("HOME"), ".config/ml/ml.cfg");
+ load_config(&ml_configs, 2, ml_configs.config_filepath, default_config_path);
+
+ // re-read cli options again, to overwrite file configuration options
util_load_cli(&ml_configs, argc, argv);
argc -= optind;
argv += optind;
+
Layer *network = load_network(ml_configs);
Array X, y;
Feel free to download, copy and edit any repo