ludwig 模型类型:GBM - "ValueError: num_actors参数设置为0 - lightgbm_ray调用中缺少RayParams"

px9o7tmv  于 2个月前  发布在  其他
关注(0)|答案(2)|浏览(31)

在使用lightgbm训练模型时,遇到了一个错误,提示如下:

ValueError: The `num_actors` 参数设置为0。请始终指定您想要使用的分布式actors的数量。通过将 `RayParams(num_actors=X)` 参数传递给您的 lightgbm_ray 调用来解决此问题。

安装过程:

!pip install ludwig[tree,distributed]==0.8.2

完整的错误信息在 txt 文件中,如下所示:

[light_gbm_error.txt](https://github.com/ludwig-ai/ludwig/files/13596041/light_gbm_error.txt)

在本地环境下可以正常训练模型,但在ray集群上出现上述错误。以下是用于训练的模型配置文件:

{
 "dl_config": {
 "input_features": [
  { "name": "I1", "type": "number"},
  { "name": "I2", "type": "number"},
  { "name": "I3", "type": "number"},
  { "name": "C1", "type": "category"},
  { "name": "C2", "type": "category"},
  { "name": "C3", "type": "category"},
  { "name": "C4", "type": "category"},
  { "name": "C5", "type": "category"}
 ],
 "output_features": [
  { "name": "Label",
   "type": "binary"
  }
 ],
 "model_type": "gbm",
 "trainer" : {
  "num_boost_round": 150,
  "early_stop": 30,
  "learning_rate": 0.001,
  "boosting_type": "gbdt",
  "num_leaves": 82
 }
 }
}
sirbozc5

sirbozc51#

我们可以在设置中添加 "num_workers": 2,如下所示。


"backend": {"type":"ray", "trainer":{"num_workers": 2, "resources_per_worker":{"CPU": 1}}

然而,在使用 ludwig[distributed,tree] 进行预测时,我们遇到了以下异常:

(ServeReplica:recomd.recomd_model_nw_1_serve:prediction pid=1283) from sklearn.ensemble import (

(ServeReplica:recomd.recomd_model_nw_1_serve:prediction pid=1283) ImportError: cannot import name 'HistGradientBoostingClassifier' from 'sklearn.ensemble' (/opt/foresight_venv/lib/python3.8/site-packages/sklearn/ensemble/**init**.py)

完整的错误信息-  [lightgbm_prediction_error.txt](https://github.com/ludwig-ai/ludwig/files/13614340/lightgbm_prediction_error.txt)

ludwig[distributed,tree]==0.8.2 的要求-  [ludwig_distributed_tree.txt](https://github.com/ludwig-ai/ludwig/files/13614345/ludwig_distributed_tree.txt)
67up9zun

67up9zun2#

你好,@rishabr-aizencorp!感谢你标记问题并提供requirements.txt文件。它似乎很奇怪,因为:

  1. 你现在使用的是scikit-learn 0.23.2版本
  2. HistGradientBoostingClassifier从scikit-learn 0.21版本开始支持
  3. 这是scikit-learn 0.23.2版本中应该逻辑上支持此导入的文档:https://scikit-learn.org/0.23/modules/generated/sklearn.ensemble.HistGradientBoostingClassifier.html#sklearn.ensemble.HistGradientBoostingClassifier
    我认为我们需要几天时间来重现这个问题,然后回来提供解决方案。

相关问题