简体   繁体   English

如何在Google Colab中解决“没有名为“工具”的模块”?

[英]How to solve “No module named 'tools'” in google colab?

I am trying to follow this tutorial to apply Bert in my data: https://medium.com/swlh/a-simple-guide-on-using-bert-for-text-classification-bbf041ac8d04 我正在尝试按照本教程将Bert应用于我的数据: https : //medium.com/swlh/a-simple-guide-on-using-bert-for-text-classification-bbf041ac8d04

And Getting error on imports 以及导入错误

This is what I am importing 这就是我要导入的

import torch
import pickle
from torch.utils.data import (DataLoader, RandomSampler, SequentialSampler, TensorDataset)
from torch.nn import CrossEntropyLoss, MSELoss

from tqdm import tqdm_notebook, trange
import os
from pytorch_pretrained_bert import BertTokenizer, BertModel, BertForMaskedLM, BertForSequenceClassification
from pytorch_pretrained_bert.optimization import BertAdam, WarmupLinearSchedule

from multiprocessing import Pool, cpu_count
from tools import *
import convert_examples_to_features

and getting error on: from tools import * as "No module named 'tools'". 并出现以下错误:从工具import *作为“没有名为'tools'的模块”。

I tried to follow some answers like: Python/Caffe2: ImportError: No module named tools.setup_helpers.env 我试图遵循一些答案,例如: Python / Caffe2:ImportError:没有名为tools.setup_helpers.env的模块

pyserial: No module named tools pyserial:没有名为工具的模块

ModuleNotFoundError: No module named 'tools.nnwrap' ModuleNotFoundError:没有名为“ tools.nnwrap”的模块

However, these answers didn't solve the error for me. 但是,这些答案并不能为我解决错误。

Please help! 请帮忙!

The error may be because you don't have the tools.py file in your working folder. 该错误可能是因为您的工作文件夹中没有tools.py文件。 You can take that file from the GitHub location mentioned in the tutorial you are referring to. 您可以从您所参考的教程中提到的GitHub位置获取该文件。 Here is the link for your reference. 这是供您参考的链接。 https://github.com/ThilinaRajapakse/BERT_binary_text_classification https://github.com/ThilinaRajapakse/BERT_binary_text_classification

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

相关问题 导入错误:在 Colab google 中没有名为 ... 的模块 - ImportError: No module named ... in Colab google 如何解决 ModuleNotFoundError:没有名为“google.colab”的模块 - How to resolve ModuleNotFoundError: No module named 'google.colab' Google Colab 中没有名为“utils.utils”的模块 - No module named 'utils.utils' in Google Colab Google colab:ModuleNotFoundError:没有名为“pymorphy2”的模块 - Google colab : ModuleNotFoundError: No module named 'pymorphy2' ModuleNotFoundError:没有名为“google.colab”的模块 - Python - ModuleNotFoundError: No module named 'google.colab' - Python ModuleNotFoundError:Google Colab 上没有名为“nets”的模块 - ModuleNotFoundError: No module named 'nets' on Google Colab ModuleNotFoundError:Google Colab 中没有名为“pyaudio”的模块 - ModuleNotFoundError: No module named 'pyaudio' in Google Colab 如何解决“ImportError: No module named google.auth”? - How to solve "ImportError: No module named google.auth"? 没有名为…的模块…尝试从google Colab中的笔记本导入自定义python模块 - no module named … try to importcustom python module from a notebook in google Colab 如何解决“没有名为 mysqldb 的模块”? - How to solve 'no module named mysqldb'?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM