簡體   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