获取LightGBM / LGBM在Google Colabratory上使用GPU运行

问题描述 投票:1回答:1

我经常在Google Colabratory上运行LGBM,我刚发现此页面说LGBM默认设置为CPU,因此您需要先进行设置。https://medium.com/@am.sharma/lgbm-on-colab-with-gpu-c1c09e83f2af因此,我执行了页面上建议的代码或stackoverflow上建议的其他一些代码,如下所示, !git clone --recursive https://github.com/Microsoft/LightGBM %cd LightGBM !mkdir build %cd build !cmake ../../LightGBM !make -j4 !git clone --recursive https://github.com/Microsoft/LightGBM.git %cd LightGBM/python-package !python3 setup.py install --gpu !pip install cmake

但是我仍然遇到错误 GPU Tree Learner was not enabled in this build.Please recompile with CMake option -DUSE_GPU=1

我该如何解决?谢谢!

python gpu google-colaboratory lightgbm
1个回答
0
投票

运行后

! git clone --recursive https://github.com/Microsoft/LightGBM

您可以运行此oneliner,它将在colab中启用GPU的情况下构建和编译LightGBM:

! cd LightGBM && rm -rf build && mkdir build && cd build && cmake -DUSE_GPU=1 ../../LightGBM && make -j4 && cd ../python-package && python3 setup.py install --gpu;

希望有帮助的人; D

© www.soinside.com 2019 - 2024. All rights reserved.