gpt4 book ai didi

python - Rapids CUML 随机森林回归模型推理

转载 作者:行者123 更新时间:2023-11-30 09:40:32 25 4
gpt4 key购买 nike

我正在 Google Colab 上使用 CUML 0.10.0 库中的随机森林回归模型,但在获取模型预测时遇到问题。模型训练成功结束后,我使用 (.predict) 方法对一个非常大的数组 (41697600, 11) 进行推理。但是,我收到以下错误:

TypeError: GPU predict model only accepts float32 dtype as input, convert the data to float32 or use the CPU predict with `predict_model='CPU'`.

即使将输入 numpy 数组的 dtype 转换为 float32 并在预测方法中指定 Predict_model='CPU' 参数,该错误仍然存​​在。

这是使用的代码供您引用:

array=(X_test.values).astype('float32')
predictions = cuml_model.predict(array, predict_model='CPU',output_class=False, algo='BATCH_TREE_REORG')

模型摘要:

<bound method RandomForestRegressor.print_summary of RandomForestRegressor(n_estimators=10, max_depth=16, handle=<cuml.common.handle.Handle object at 0x7fbfa342e888>, max_features='auto', n_bins=8, n_streams=8, split_algo=1, split_criterion=2, bootstrap=True, bootstrap_features=False, verbose=False, min_rows_per_node=2, rows_sample=1.0, max_leaves=-1, accuracy_metric='mse', quantile_per_tree=False, seed=-1)>

最佳答案

这个错误消息非常令人困惑。我相信它失败了,因为训练是在 float64 中而不是预测中。因此,如果您改为使用 float32 进行训练,这应该可以正常工作。预测的优化 GPU 实现目前仅支持 float32 模型。您应该能够回退到慢速 CPU 预测,但此异常阻止了它。

我将此作为错误提交,我们将尝试在即将发布的版本中进行修复。请随意跟随或添加任何额外的问题等:https://github.com/rapidsai/cuml/issues/1406

关于python - Rapids CUML 随机森林回归模型推理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58999284/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com