无法在 Google Colab 上安装 Pytorch Lightning Flash

Posted

技术标签:

【中文标题】无法在 Google Colab 上安装 Pytorch Lightning Flash【英文标题】:Can't Install Pytorch Lightning Flash on Google Colab 【发布时间】:2021-11-18 05:43:57 【问题描述】:

Pytorch Lighting Flash 听起来对我很有希望。我正在尝试在https://lightning-flash.readthedocs.io/ 上运行最基本的教程,但我无法让它们运行。

例如,我在https://lightning-flash.readthedocs.io/en/latest/installation.html 使用安装说明在https://lightning-flash.readthedocs.io/en/stable/reference/object_detection.html 运行此对象检测示例。

我尝试了几种安装方法,但没有一种方法有效。例如:

pip install 'lightning-flash[image]'

这似乎没有任何错误。然后我导入模块

import flash
from flash.core.data.utils import download_data
from flash.image import ObjectDetectionData, ObjectDetector

闪光灯下方有一个 reg 曲线,因此看起来好像有问题。当我运行该块时,我会收到这些错误。

ImportError: /usr/local/lib/python3.7/dist-packages/torchtext/_torchtext.so: undefined symbol: _ZN2at6detail10noopDeleteEPv

【问题讨论】:

【参考方案1】:

Pytorch Lighting Flash 社区的好心人帮助调整了安装命令以使其正常工作。我在这里打开了一个带有详细信息的错误https://github.com/PyTorchLightning/lightning-flash/issues/803

按此顺序安装这些软件包有效:

!pip install torch==1.8.1+cu102 -f https://download.pytorch.org/whl/torch_stable.html
!pip install icevision #==0.9.0a1
!pip install effdet 
!pip install lightning-flash[image]
!pip install git+https://github.com/PyTorchLightning/lightning-flash.git
!pip install torchtext==0.9.1
!pip uninstall fastai -y
#There is a bug in the latest release of icevision. Manually apply the fix.
!curl https://raw.githubusercontent.com/airctic/icevision/944b47c5694243ba3f3c8c11a6ef56f05fb111eb/icevision/core/record_components.py --output /usr/local/lib/python3.7/dist-packages/icevision/core/record_components.py
#Restart the kernel

【讨论】:

以上是关于无法在 Google Colab 上安装 Pytorch Lightning Flash的主要内容,如果未能解决你的问题,请参考以下文章

可以在google colab上安装cupy吗?

Q2。无法在 Google Colab 上为 Jupyter 安装/激活 jupyter_http_over_ws

如何在 Google Colab 上安装和使用底图?

无法在 google colab 上完成 ngrok 隧道连接

Google Colab Blender 渲染错误:无法读取文件

无法在 google colab 上导入 pytorch_lightning