首页 > 解决方案 > 无法在 Google Colab 上安装 Pytorch Lightning Flash

问题描述

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

标签: pytorchpytorch-lightning

解决方案


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

推荐阅读