【发布时间】:2019-12-27 23:18:39
【问题描述】:
我正在尝试按照本教程在我的数据中应用 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 "No module named 'tools'"。
我尝试遵循一些答案,例如: Python/Caffe2: ImportError: No module named tools.setup_helpers.env
pyserial: No module named tools
ModuleNotFoundError: No module named 'tools.nnwrap'
但是,这些答案并没有解决我的错误。
请帮忙!
【问题讨论】:
-
请分享一个独立的笔记本,重现您观察到的问题。
-
你用的是哪个版本的python?
-
@BobSmith 这里是:colab.research.google.com/drive/…
标签: python pytorch google-colaboratory