add sacred
This commit is contained in:
parent
3f8833d090
commit
7905591af2
@ -11,6 +11,7 @@ WORKDIR /app
|
|||||||
|
|
||||||
COPY ./eval.py ./
|
COPY ./eval.py ./
|
||||||
COPY ./script.sh ./
|
COPY ./script.sh ./
|
||||||
|
COPY ./test.csv ./
|
||||||
RUN chmod +x script.sh
|
RUN chmod +x script.sh
|
||||||
|
|
||||||
COPY ./requirements.txt ./
|
COPY ./requirements.txt ./
|
||||||
|
@ -8,7 +8,6 @@ RUN apt install -y unzip >>/dev/null
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY ./train.py ./
|
|
||||||
COPY ./script.sh ./
|
COPY ./script.sh ./
|
||||||
RUN chmod +x script.sh
|
RUN chmod +x script.sh
|
||||||
|
|
||||||
|
@ -2,3 +2,4 @@ numpy~=1.19.2
|
|||||||
pandas
|
pandas
|
||||||
tensorflow
|
tensorflow
|
||||||
keras==2.3.1
|
keras==2.3.1
|
||||||
|
sacred
|
||||||
|
@ -1,8 +1,23 @@
|
|||||||
|
from datetime import datetime
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
from sacred import Experiment
|
||||||
|
from sacred.observers import MongoObserver
|
||||||
import sys
|
import sys
|
||||||
import tensorflow
|
import tensorflow
|
||||||
from tensorflow.keras import layers
|
from tensorflow.keras import layers
|
||||||
|
|
||||||
|
ex = Experiment("470607", interactive=False, save_git_info=False)
|
||||||
|
ex.observers.append(MongoObserver(url='mongodb://mongo_user:mongo_password_IUM_2021@172.17.0.1:27017', db_name='sacred'))
|
||||||
|
ex.observers.append(FileStorageObserver('my_runs'))
|
||||||
|
|
||||||
|
@ex.config
|
||||||
|
def my_config():
|
||||||
|
learning_rate = float(sys.argv[1])
|
||||||
|
|
||||||
|
@ex.capture
|
||||||
|
def prepare_train_model(learning_rate, _run):
|
||||||
|
_run.info["prepare_model"] = str(datetime.now())
|
||||||
|
|
||||||
X_train = pd.read_csv('train.csv')
|
X_train = pd.read_csv('train.csv')
|
||||||
X_valid = pd.read_csv('valid.csv')
|
X_valid = pd.read_csv('valid.csv')
|
||||||
|
|
||||||
@ -21,9 +36,20 @@ model = tensorflow.keras.Sequential([
|
|||||||
|
|
||||||
model.compile(
|
model.compile(
|
||||||
loss=tensorflow.keras.losses.BinaryCrossentropy(),
|
loss=tensorflow.keras.losses.BinaryCrossentropy(),
|
||||||
optimizer=tensorflow.keras.optimizers.Adam(lr=float(sys.argv[1])),
|
optimizer=tensorflow.keras.optimizers.Adam(lr=learning_rate),
|
||||||
metrics=[tensorflow.keras.metrics.BinaryAccuracy()])
|
metrics=[tensorflow.keras.metrics.BinaryAccuracy()])
|
||||||
|
|
||||||
history = model.fit(X_train, Y_train, epochs=2, validation_data=(X_valid, Y_valid))
|
history = model.fit(X_train, Y_train, epochs=2, validation_data=(X_valid, Y_valid))
|
||||||
|
|
||||||
model.save('grid-stability-dense.h5')
|
model.save('grid-stability-dense.h5')
|
||||||
|
|
||||||
|
_run['history'] = history
|
||||||
|
|
||||||
|
@ex.main
|
||||||
|
def my_main(learning_rate):
|
||||||
|
print(prepare_train_model())
|
||||||
|
|
||||||
|
|
||||||
|
r = ex.run()
|
||||||
|
ex.add_artifact('grid-stability-dense.h5')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user