2

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

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'".

I tried to follow some answers like: Python/Caffe2: ImportError: No module named tools.setup_helpers.env

pyserial: No module named tools

ModuleNotFoundError: No module named 'tools.nnwrap'

However, these answers didn't solve the error for me.

Please help!

sariii
  • 2,020
  • 6
  • 29
  • 57
khushbu
  • 567
  • 2
  • 8
  • 24

1 Answers1

0

The error may be because you don't have the tools.py file in your working folder. You can take that file from the GitHub location mentioned in the tutorial you are referring to. Here is the link for your reference. https://github.com/ThilinaRajapakse/BERT_binary_text_classification

Monisha
  • 1
  • 1