简体   繁体   中英

How to enable GPU accelration on H2O in Python?

I am trying to train deep learning neural nets on my AWS server using Python and H2O and I would like to enable GPU acceleration to speed up the training. Please let me know the code snippet to use GPU instead of CPU. AWS uses OpenGL. The elastic GPU type is eg1.xlarge with 4 GB memory.

The code for my model is:

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()

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM