繁体   English   中英

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

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

我正在尝试按照本教程将Bert应用于我的数据: https : //medium.com/swlh/a-simple-guide-on-using-bert-for-text-classification-bbf041ac8d04

以及导入错误

这就是我要导入的

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

并出现以下错误:从工具import *作为“没有名为'tools'的模块”。

我试图遵循一些答案,例如: Python / Caffe2:ImportError:没有名为tools.setup_helpers.env的模块

pyserial:没有名为工具的模块

ModuleNotFoundError:没有名为“ tools.nnwrap”的模块

但是,这些答案并不能为我解决错误。

请帮忙!

该错误可能是因为您的工作文件夹中没有tools.py文件。 您可以从您所参考的教程中提到的GitHub位置获取该文件。 这是供您参考的链接。 https://github.com/ThilinaRajapakse/BERT_binary_text_classification

暂无
暂无

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

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