如何在Python中的H2O上启用GPU加速?

时间:2018-08-06 16:11:13

标签: python gpu h2o

我正在尝试使用Python和H2O在我的AWS服务器上训练深度学习神经网络,我希望启用GPU加速来加快训练速度。请让我知道使用GPU而不是CPU的代码片段。 AWS使用OpenGL。弹性GPU类型为eg1.xlarge,具有4 GB内存。

我的模型的代码是:

nn = H2OGridSearch(model=H2ODeepLearningEstimator,
                               hyper_params = {
        'activation' :[ "Rectifier","Tanh","Maxout","RectifierWithDropout","TanhWithDropout","MaxoutWithDropout"],
        'hidden':[[20,20],[50,50],[30,30,30],[25,25,25,25]],            ## small network, runs faster
#        'rate' :[0.0005,0.001,0.0015,0.002,0.0025,0.003,0.0035,0.0040,0.0045,0.005],
         'l1':[0,1e-4,1e-6],
         'l2':[0,1e-4,1e-6]
        })

start_time = time.time()

nn.train(
        train1_x, train1_y,train1,
        score_validation_samples = 10000,      ## sample the validation dataset (faster)
        stopping_rounds = 2,
        stopping_metric ="MSE", ## alternatives: "MSE","logloss","r2"
        epochs=1000000,  
        stopping_tolerance = 0.01,
        max_w2 = 10
        )
end_time = time.time()

1 个答案:

答案 0 :(得分:3)

如果您有兴趣运行启用了GPU的H2O.ai产品,请仅启用c2-H2O-3,请参阅H2O4GPU或无驱动程序的AI(请注意:后者是开源的)