【问题标题】:is there any way to train spacy on google colab gpu?有没有办法在 google colab gpu 上训练 spacy?
【发布时间】:2019-10-26 20:22:14
【问题描述】:

我想在自定义数据集上训练 spacy 模型,但是训练时间太长,有什么方法可以加快训练速度。 我在 ner.begin_training() 中传递了 device=0,但它需要的时间与以前相同。

【问题讨论】:

    标签: google-colaboratory spacy


    【解决方案1】:

    是的,有可能。

    1. 转到[EDIT] -> [Notebook settings] -> 在Hardware Acceleration 下选择GPU(它会重新启动运行时,因此您的所有单元状态都会丢失)
    2. 使用 !pip install -U spacy[cuda100] 通过 Cuda 支持安装 spacy
    3. 运行以下命令

    脚本:

    import spacy
    gpu = spacy.prefer_gpu()
    print('GPU:', gpu)
    

    返回:

    GPU: True
    

    【讨论】:

    • Google Colab 现在有 Cuda 10.1,每个“!nvcc --version”。然后你应该做“!pip install -U spacy[cuda101]”
    猜你喜欢
    • 2021-03-17
    • 2019-11-02
    • 1970-01-01
    • 2022-06-23
    • 2020-08-13
    • 2020-12-24
    • 1970-01-01
    • 1970-01-01
    • 2021-07-24
    相关资源
    最近更新 更多