python lightgbm gpu版本,启动!

  • 环境
    • Ubuntu 20.04.2
    • Python 3.8.10
    • Nvidia-smi driver 535.104.05
    • cuda 12.2
    • torch 1.13.1+cu116(torch cuda 11.6)
  • 步骤
    • 注:因为先尝试了pip3 install lightgbm, 安装了没有gpu兼容性的3.1.1版本, 所以下面安装时使用了--upgrade选项
    • 复制代码
      >  python3 -m pip install --upgrade pip
      ...
      Installing collected packages: pip
      Successfully installed pip-24.2
      >  pip3 install lightgbm --upgrade
      Defaulting to user installation because normal site-packages is not writeable
      Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
      Requirement already satisfied: lightgbm in /usr/local/lib/python3.8/dist-packages (3.1.1)
      Collecting lightgbm
      Downloading https://pypi.tuna.tsinghua.edu.cn/packages/4e/19/1b928cad70a4e1a3e2c37d5417ca2182510f2451eaadb6c91cd9ec692cae/lightgbm-4.5.0-py3-none-manylinux_2_28_x86_64.whl (3.6 MB)
      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.6/3.6 MB 20.2 MB/s eta 0:00:00
      Requirement already satisfied: numpy>=1.17.0 in /usr/local/lib/python3.8/dist-packages (from lightgbm) (1.19.5)
      Requirement already satisfied: scipy in /usr/local/lib/python3.8/dist-packages (from lightgbm) (1.10.1)
      Installing collected packages: lightgbm
      Successfully installed lightgbm-4.5.0
      复制代码
  •  测试
    • 复制代码
      >  python3
      Python 3.8.10 (default, Jul 29 2024, 17:02:10) 
      [GCC 9.4.0] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import lightgbm as lgb
      >>> import numpy as np
      >>> a1 = np.random.random((10,3))
      >>> a2 = np.random.random(10)
      >>> para = {'device_type': 'gpu'}
      >>> model = lgb.train(para,train_set=lgb.Dataset(a1,a2))
      [LightGBM] [Warning] There are no meaningful features which satisfy the provided configuration. Decreasing Dataset parameters min_data_in_bin or min_data_in_leaf and re-constructing Dataset might resolve this warning.
      [LightGBM] [Info] This is the GPU trainer!!
      [LightGBM] [Info] Total Bins 0
      [LightGBM] [Info] Number of data points in the train set: 10, number of used features: 0
      [LightGBM] [Info] Using GPU Device: NVIDIA H100 PCIe, Vendor: NVIDIA Corporation
      [LightGBM] [Info] Compiling OpenCL Kernel with 16 bins...
      1 warning generated.
      1 warning generated.
      ... ...
      1 warning generated.
      1 warning generated.
      [LightGBM] [Info] GPU programs have been built
      [LightGBM] [Warning] GPU acceleration is disabled because no non-trivial dense features can be found
      [LightGBM] [Info] Start training from score 0.482093
      [LightGBM] [Warning] Stopped training because there are no more leaves that meet the split requirements
      [LightGBM] [Warning] Stopped training because there are no more leaves that meet the split requirements
      ... ...
      [LightGBM] [Warning] Stopped training because there are no more leaves that meet the split requirements
      ... ...
      复制代码

       

posted on   Mju_halcyon  阅读(163)  评论(1编辑  收藏  举报

相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示