Add MongoObserver (sacred)

This commit is contained in:
Agata 2022-05-08 15:53:03 +02:00
parent d0a5a7c513
commit 78dd1d38fd
2 changed files with 12 additions and 3 deletions

View File

@ -8,6 +8,7 @@ RUN pip3 install torch
RUN pip3 install numpy
RUN pip3 install sacred
RUN pip3 install GitPython
RUN pip3 install pymongo
WORKDIR /app

View File

@ -12,14 +12,15 @@ from torch import nn, optim
import torch.nn.functional as F
import sys
from sacred import Experiment
from sacred.observers import FileStorageObserver
from sacred.observers import FileStorageObserver, MongoObserver
# In[ ]:
ex = Experiment("file_observer", save_git_info=False)
ex.observers.append(FileStorageObserver('my_runs'))
ex = Experiment(save_git_info=False)
# ex.observers.append(FileStorageObserver('my_runs'))
ex.observers.append(MongoObserver(url='mongodb://mongo_user:mongo_password@localhost:27017', db_name='sacred'))
@ex.config
def my_config():
@ -111,3 +112,10 @@ def my_main(epochs, _run):
_run.info["epochs"] = epochs
_run.info["loss"] = loss
# In[ ]:
ex.run()