我正在尝试按照本教程在我的数据中应用 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
并出现错误:from tools import * as“没有名为“tools”的模块”。
我尝试遵循一些答案,例如: Python/Caffe2: ImportError: No module named tools.setup_helpers.env
pyserial: No module named tools
ModuleNotFoundError: No module named 'tools.nnwrap'
但是,这些答案并没有解决我的错误。
请帮忙!
最佳答案
该错误可能是因为您的工作文件夹中没有tools.py 文件。您可以从您所引用的教程中提到的 GitHub 位置获取该文件。这是供您引用的链接。 https://github.com/ThilinaRajapakse/BERT_binary_text_classification
关于python - 如何解决google colab中的 "No module named '工具''?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57612610/