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 2024-08-21 14:40 Mju_halcyon 阅读(163) 评论(1) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?