在Googe Colab笔记本上安装RAPIDS库

时间:2018-12-17 10:19:40

标签: google-colaboratory rapids

我想知道是否可以在Google Colaboratory笔记本中安装RAPIDS库(完全在GPU上执行机器学习任务)?

我已经做过一些研究,但是我找不到解决方法...

4 个答案:

答案 0 :(得分:7)

现在可以使用新的T4实例https://medium.com/rapids-ai/run-rapids-on-google-colab-for-free-1617ac6323a8

要同时启用cuGraph,可以将wget命令替换为:

!conda install -c nvidia / label / cuda10.0 -c Rapidsai / label / cuda10.0 -c pytorch \     -c numba -c conda-forge -c numba -c默认值\     提升cudf = 0.6 cuml = 0.6 python = 3.6 cugraph = 0.6 -y

答案 1 :(得分:2)

2019年12月更新

RAPIDS v0.11 +的新过程

因为

  • RAPIDS v0.11具有依赖项(pyarrow),它们分别是 以前的安装脚本未涵盖
  • notebooks-contrib存储区,其中包含RAPIDS演示笔记本(例如 colab_notebooks)和Colab安装脚本,现在遵循RAPIDS标准特定于版本的分支结构*
  • 某些Colab用户仍然喜欢v0.10,

我们尊敬的笔记本电脑制造商霸主taureandyernv已更新了脚本,该脚本现在:

如果运行v0.11或更高版本,请将pyarrow库更新为0.15.x。

这是要在Colab中为v0.11运行的代码单元:

(defmacro defplanet (name coordinates)
  (check-type name (or string symbol)
              "The name of the planet must be a symbol or a string.")
  `(intern-planet ,name (check-coordinates ,coordinates)))       

有关设置Colab和实现此脚本的详细信息,请参阅How to Install RAPIDS in Google Colab

-*例如branch-0.11(适用于v0.11)和branch-0.12(适用于v0.12),默认设置为当前版本

答案 2 :(得分:1)

看起来各个子部分尚不能通过pip安装,因此将它们安装在colab上的唯一方法是在colab上构建它们,这可能比您有兴趣在此方面投入更多的精力:) https://github.com/rapidsai/cudf/issues/285是需要注意Rapidsai / cudf的问题(大概其他Rapidsai /库也将效仿)。

答案 3 :(得分:1)

最新解决方案;

!wget -nc https://github.com/rapidsai/notebooks-extended/raw/master/utils/rapids-colab.sh
!bash rapids-colab.sh

import sys, os

sys.path.append('/usr/local/lib/python3.6/site-packages/')
os.environ['NUMBAPRO_NVVM'] = '/usr/local/cuda/nvvm/lib64/libnvvm.so'
os.environ['NUMBAPRO_LIBDEVICE'] = '/usr/local/cuda/nvvm/libdevice/'

是在几天前推送的,请查看问题https://github.com/statsmodels/statsmodels/issues/6013#104或完整的rapids-colab.sh #110,以了解更多信息。

注意:灌输当前需要一个Tesla T4实例,可以通过以下方式进行检查;

# check gpu type
!nvidia-smi

import pynvml

pynvml.nvmlInit()
handle = pynvml.nvmlDeviceGetHandleByIndex(0)
device_name = pynvml.nvmlDeviceGetName(handle)

# your dolphin is broken, please reset & try again
if device_name != b'Tesla T4':
  raise Exception("""Unfortunately this instance does not have a T4 GPU.

    Please make sure you've configured Colab to request a GPU instance type.

    Sometimes Colab allocates a Tesla K80 instead of a T4. Resetting the instance.

    If you get a K80 GPU, try Runtime -> Reset all runtimes...""")

# got a T4, good to go 
else:
  print('Woo! You got the right kind of GPU!')