From 2443fcf2e3221cddc46438dab9c127a8514341fd Mon Sep 17 00:00:00 2001 From: Cornelius Specht Date: Thu, 13 Jun 2024 11:37:49 +0200 Subject: [PATCH] add optimizer --- .woodpecker.yml | 3 +++ run.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 8d770db..126e682 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,6 +2,9 @@ matrix: EPOCHS: - 20 - 30 + OPTIMIZER: + - adam + - SGD steps: "train": diff --git a/run.py b/run.py index d4fa441..d8d5090 100644 --- a/run.py +++ b/run.py @@ -9,7 +9,7 @@ from keras import backend as K K.clear_session() EPOCHS = int(os.getenv("EPOCHS", default = 10)) - +OPTIMIZER = os.getenv("OPTIMIZER", default = "SGD") gpus = tf.config.experimental.list_physical_devices('GPU') @@ -72,7 +72,7 @@ with tf.device('/GPU:0'): keras.layers.Dense(10, activation='sigmoid') ]) # g - model.compile(optimizer='SGD', + model.compile(optimizer=OPTIMIZER, loss='categorical_crossentropy', metrics=['accuracy']) model.fit(X_train_scaled, y_train_categorical, epochs=EPOCHS)