1

当我尝试使用此示例代码训练在谷歌云ML我的模型:谷歌云ML退出与245非零状态训练

import keras 
from keras import optimizers 
from keras import losses 
from keras import metrics 
from keras.models import Model, Sequential 
from keras.layers import Dense, Lambda, RepeatVector, TimeDistributed 
import numpy as np 

def test(): 
    model = Sequential() 
    model.add(Dense(2, input_shape=(3,))) 
    model.add(RepeatVector(3)) 
    model.add(TimeDistributed(Dense(3))) 
    model.compile(loss=losses.MSE, 
        optimizer=optimizers.RMSprop(lr=0.0001), 
        metrics=[metrics.categorical_accuracy], 
        sample_weight_mode='temporal') 
    x = np.random.random((1, 3)) 
    y = np.random.random((1, 3, 3)) 
    model.train_on_batch(x, y) 

if __name__ == '__main__': 
    test() 

,我得到这个错误:

The replica master 0 exited with a non-zero status of 245. Termination reason: Error. 

详细的错误产量大,所以我把它粘贴here in pastebin

+0

在console.google.com中,转到汉堡包菜单,选择“ML Engine> Jobs”,然后单击您的工作。滚动到底部。你的内存使用情况如何?你可以有OOMed吗? – rhaertel80

+0

这个特殊的工作'这个图表没有数据'。但对于我的其他工作来说,这更复杂,并且具有相同的错误,内存使用量为0.0359 – Alex

+0

日志输出表明您正在遇到分段错误。通过您的Cloud ML作业,您可以指定要使用哪个版本的TensorFlow? –

回答

0

问题已解决。我所要做的就是使用tensorflow 1.1.0代替默认值1.0.1

+0

你是如何改变tensorflow版本的? –

+0

@BadgerCat只需添加到setup.py安装需求tensorflow == 1.1.0 – Alex

0

注意此输出:

Module raised an exception for failing to call a subprocess Command '['python', '-m', u'trainer.test', '--job-dir', u'gs://my_test_bucket_keras/s_27_100630']' returned non-zero exit status -11. 

我想google云会运行一个名为--job-dir的额外参数。所以也许你可以尝试在示例代码中添加下面的代码?

import ... 
import argparse 

def test(): 
model = Sequential() 
model.add(Dense(2, input_shape=(3,))) 
model.add(RepeatVector(3)) 
model.add(TimeDistributed(Dense(3))) 
model.compile(loss=losses.MSE, 
       optimizer=optimizers.RMSprop(lr=0.0001), 
       metrics=[metrics.categorical_accuracy], 
       sample_weight_mode='temporal') 
x = np.random.random((1, 3)) 
y = np.random.random((1, 3, 3)) 
model.train_on_batch(x, y) 

if __name__ == '__main__': 
    parser = argparse.ArgumentParser() 
    # Input Arguments 
    parser.add_argument(
     '--job-dir', 
     help='GCS location to write checkpoints and export models', 
     required=True 
    ) 
    args = parser.parse_args() 
    arguments = args.__dict__ 

    test() 
    # test(**arguments) # or if you want to use this job_dir parameter in your code 

不是100%肯定这会起作用,但我认为你可以试一试。 我也有一个post here做类似的事情,也许你也可以看看那里。

+0

谢谢,实际上,当我开始使用谷歌ML时,我遵循本教程,它的工作。但看起来像代码不是问题。 – Alex