繁体   English   中英

在 google colab 中使用 MS nlp_recipes 时没有名为“utils_nlp”的模块

[英]No module named 'utils_nlp' when using MS nlp_recipes in google colab

我想在我的 google colab 项目中使用来自 MS 的nlp_recipes github repo 中提供的 utils_nlp。 但是,我收到“没有名为 'utils_nlp' 的模块”错误。 这是我尝试过的:

在 nlp_recipes 的 设置中指出:

也可以直接从 Github 安装,这是在外部项目中利用 utils_nlp package 的最佳方式(同时仍然反映源的更新,因为它作为可编辑的“-e”包安装)。

pip install -e git+git@github.com:microsoft/nlp-recipes.git@master#egg=utils_nlp

在 colab 我跑

!pip install -e git+https://github.com/microsoft/nlp-recipes.git@master#egg=utils_nlp

哪个完美

从 git+https://github.com/microsoft/nlp recipes.git@master#egg=utils_nlp 获取 utils_nlp 克隆https://github.com/microsoft/nlp-recipes.git (to revision master) to. /utils-nlp 运行命令 git clone -q https://github.com/microsoft/nlp-recipes.git /content/src/utils 安装依赖项...
获得制造轮子的要求......完成
正在准备车轮元数据...完成
安装收集的包:utils-nlp
运行 setup.py develop for utils-nlp 成功安装 utils-nlp

当我做!pip list我得到

utils-nlp 2.0.0 /content/src/utils-nlp

例如,当我想从 utils-nlp 导入时

from utils_nlp.dataset.preprocess import to_lowercase, to_spacy_tokens

我得到一个

没有名为“utils_nlp”的模块

我尝试使用sys.path.append("/content/src/")和许多其他路径到 append 但这些似乎都不起作用。

任何想法?

在安装后和导入之前重新启动运行时。

重启命令为: 在此处输入图像描述

一个完整的例子是: 在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM