我经常在 Google Colabatory 上运行 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
我该如何修复它?
谢谢你!
运行后
! 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 --precompile --gpu;
希望有帮助;D
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)