Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

[ASK] transformers.abstractive_summarization_bertsum.py not importing transformers #625

Open
neqkir opened this issue Jan 11, 2022 · 1 comment

Comments

@neqkir
Copy link

neqkir commented Jan 11, 2022

Description

I run in Google Colab the following code

!pip install --upgrade 
!pip install -q git+https://github.com/microsoft/nlp-recipes.git
!pip install jsonlines
!pip install pyrouge
!pip install scrapbook

import os
import shutil
import sys
from tempfile import TemporaryDirectory
import torch
import nltk
from nltk import tokenize
import pandas as pd
import pprint
import scrapbook as sb

nlp_path = os.path.abspath("../../")
if nlp_path not in sys.path:
    sys.path.insert(0, nlp_path)

from utils_nlp import models
from utils_nlp.models import transformers 
from utils_nlp.models.transformers.abstractive_summarization_bertsum \
     import BertSumAbs, BertSumAbsProcessor

It breaks on the last line and I get the following error

/usr/local/lib/python3.7/dist-packages/utils_nlp/models/transformers/abstractive_summarization_bertsum.py in <module>()
     15 from torch.utils.data.distributed import DistributedSampler
     16 from tqdm import tqdm
---> 17 from transformers import AutoTokenizer, BertModel
     18 
     19 from utils_nlp.common.pytorch_utils import (

ModuleNotFoundError: No module named 'transformers'

In summary, the code in abstractive_summarization_bertsum.py doesn't resolve transformers where it is located in the transformer folder. Is it something to be fixed on your side?

@neqkir neqkir changed the title [ASK] [ASK] transformers.abstractive_summarization_bertsum.py not importing transformers Jan 11, 2022
@gbot300
Copy link

gbot300 commented Feb 17, 2022

I am getting the same issue after doing a pip install of the repo into google colab. It breaks on exactly the same place, also unable to find transfomers

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants