1

我尝试在 AWS 实例上使用 lightGBM 和 python。我可以使用标准 lightgbm 进行训练,但如果我将其与 GPU 加速一起使用。它显示以下错误

LightGBMError                             Traceback (most recent call last)
<ipython-input-28-758038d46621> in <module>()
----> 1 train_blend_x_lgb, test_blend_x_lgb, blend_scores_lgb = lgb_rgr_stack(lgb_params, train_x, y, test_x, 5, early_stopping_rounds=0, missing=None)
      2 train_blend_x_lgb.tofile('train_blend_x_lgb_v2.dat')
      3 test_blend_x_lgb.tofile('test_blend_x_lgb_v2.dat')

<ipython-input-16-ba585885e839> in lgb_rgr_stack(rgr_params, train_x, train_y, test_x, kfolds, early_stopping_rounds, missing)
     25                                                 feature_name=full_vars,
     26                                                 categorical_feature = dense_cat_vars),
---> 27                                   num_boost_round=num_boost_round
     28                                 )
     29                 val_y_predict_fold = model.predict(val_x_fold)

~/anaconda3/lib/python3.6/site-packages/lightgbm/engine.py in train(params, train_set, num_boost_round, valid_sets, valid_names, fobj, feval, init_model, feature_name, categorical_feature, early_stopping_rounds, evals_result, verbose_eval, learning_rates, keep_training_booster, callbacks)
    181     # construct booster
    182     try:
--> 183         booster = Booster(params=params, train_set=train_set)
    184         if is_valid_contain_train:
    185             booster.set_train_data_name(train_data_name)

~/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py in __init__(self, params, train_set, model_file, silent)
   1307                 train_set.construct().handle,
   1308                 c_str(params_str),
-> 1309                 ctypes.byref(self.handle)))
   1310             # save reference to data
   1311             self.train_set = train_set

~/anaconda3/lib/python3.6/site-packages/lightgbm/basic.py in _safe_call(ret)
     47     """
     48     if ret != 0:
---> 49         raise LightGBMError(decode_string(_LIB.LGBM_GetLastError()))
     50 
     51 

LightGBMError: No OpenCL device found
4

1 回答 1

1

您是否向 EC2 实例添加了 GPU?默认情况下,它们不附带 GPU。GPU相当昂贵。添加一个 GPU 看看是否有帮助。

https://aws.amazon.com/ec2/elastic-gpus/

于 2018-07-11T01:05:29.083 回答