我有两台电脑:Ubuntu1 和 Ubuntu2。Ubuntu1 运行带有数据库 Sacred3 的 MongoDB。我想通过 ssh 从 U2 连接到 U1 并将我的实验结果存储在那里。
我尝试过但失败了: 1. 我安装了 mongo DB,创建了神圣 3,我有 ssh 密钥。我编辑/etc/mongod.conf
添加:
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
然后我启用了端口转发
ssh -fN -i ~/.ssh/sacred_key-pair.pem -L 6666:localhost:27017 ubuntu@106.969.696.969
//(使用正确的 ip)
所以,据我所知,如果我连接到我的 localhost:6666 它将被转发到 106.969.696.969:27017
因此,在那之后,我正在使用Sacred 框架进行实验:
python exp1.py -m localhost:6666:sacred3
这应该将实验写入远程数据库,但是我得到:
pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused
这让我发疯。请帮忙!
#exp1.py 的以下内容:
from sacred import Experiment
from sacred.observers import MongoObserver
ex = Experiment()
ex.observers.append(MongoObserver.create())
def compute():
summ = layer1 - layer2
return summ
@ex.config
def my_config():
hp_list = [{"neurons" : [32,32] , "dropout": 1.0},
{"neurons" : [32,32] , "dropout": 0.7},
{"neurons" : [32,16] , "dropout": 0.9},
{"neurons" : [24,16] , "dropout": 0.9},
{"neurons" : [24,8] , "dropout": 0.9},
{"neurons" : [16,8] , "dropout": 0.9},
{"neurons" : [64,64] , "dropout": 0.9},
{"neurons" : [64,64] , "dropout": 0.7},
{"neurons" : [64,32] , "dropout": 0.9},
{"neurons" : [64,32] , "dropout": 0.7},
{"neurons" : [48,32] , "dropout": 0.9},
{"neurons" : [48,32] , "dropout": 0.7},
{"neurons" : [48,16] , "dropout": 0.9},
{"neurons" : [48,16] , "dropout": 0.7},]
n_epochs = 2
@ex.capture
def training_loop(hp_list, n_epochs):
for j in hp_list:
print("Epoch: ", n_epochs)
# layer1 = random.randint(18,68)
# layer2 = random.randint(18,68)
# layer3 = random.randint(18,68)
layer1 = j["neurons"][0]
layer2 = j["neurons"][1]
dropout_ratio = j["dropout"]
print("WHATS UUUUUP",j, layer1, layer2, dropout_ratio, sep="_")
# vae_training_loop_NN_DO(i, layer1, layer2, dropout_ratio )
@ex.automain
def my_main():
training_loop()