【问题标题】:I have downloaded an have Unzipped the glove file in my google colab , but still I'm unable to access it我已经在我的 google colab 中下载了一个解压手套文件,但我仍然无法访问它
【发布时间】:2020-03-08 12:40:35
【问题描述】:
当我尝试访问以运行此代码时出现此错误:
word_embedding_matrix = np.load(open("word_embedding_matrix.npy", 'rb'))
FileNotFoundError
Traceback(最近一次通话最后一次)
在 ()
----> 1 word_embedding_matrix = np.load(open("word_embedding_matrix.npy", 'rb'))
FileNotFoundError: [Errno 2] 没有这样的文件或目录:'word_embedding_matrix.npy'
【问题讨论】:
标签:
python
nlp
google-colaboratory
glove
【解决方案1】:
最常见的原因是您没有将 google 驱动器安装到笔记本上。您可以通过在笔记本的第一个单元格中运行以下代码轻松做到这一点:
import os
from google.colab import drive
drive.mount('/content/gdrive')
ROOT = "/content/gdrive/My Drive/"
os.chdir(ROOT)
此代码使您的笔记本可以访问您的 Google Drive,并且您可以像访问本地磁盘一样访问您的 GoogleDrive。因此,当您运行
os.listdir('.') 时,您应该在返回的项目中找到word_embedding_matrix.npy。
来源:official documentation