Transformers: SummarizationPipeline crashes

Created on 21 May 2020  路  12Comments  路  Source: huggingface/transformers

summarize = pipeline("summarization")
summarize("Sam Shleifer writes the best docstring examples in the whole world.")

鉃★笍

/usr/local/lib/python3.6/dist-packages/transformers/pipelines.py in _parse_and_tokenize(self, pad_to_max_length, *args, **kwargs)
    461         # Parse arguments
    462         inputs = self._args_parser(*args, **kwargs)
--> 463         inputs = self.tokenizer.batch_encode_plus(
    464             inputs, add_special_tokens=True, return_tensors=self.framework, pad_to_max_length=pad_to_max_length,
    465         )

AttributeError: 'dict' object has no attribute 'batch_encode_plus'
Pipeline Summarization

Most helpful comment

Yeah that sounds like this issue. It will be fixed in the next release or you can build from source with

git clone [this repo]
pip install -e .

All 12 comments

Is this issue fixed in version 2.10.0?

@julien-c I still get the same error when doing

summarizer = pipeline('summarization')

and using it to summarize.

However the following explicitely works for me:

summarizer = pipeline('summarization', model='bart-large-cnn', tokenizer='bart-large-cnn')

Yeah that sounds like this issue. It will be fixed in the next release or you can build from source with

git clone [this repo]
pip install -e .

Yeah that sounds like this issue. It will be fixed in the next release or you can build from source with

git clone [this repo]
pip install -e .

I have installed the package from GitHub repo but still have the same issue right now.

@khalilRhouma: It works for me at commit d976ef262e0b2c52363d201b2e14e5ecc42abbb3 , so you may need to git pull or some such. If that doesn't work I would love to see the output of

transformers-cli env

@sshleifer I get this error when I clone with that commit ID.
KeyError: "Unknown task summarization, available tasks are ['feature-extraction', 'sentiment-analysis', 'ner', 'question-answering', 'fill-mask']"
@dipanjanS Would be great to know what configuration you used

current master should also work.

@sshleifer The kernel still crashes
Attaching the code.

from transformers import pipeline
import torch

!git clone https://github.com/huggingface/transformers.git
%cd transformers
`!pip` install -e ".[dev]"

#summarizer = pipeline("summarization")
summarizer = pipeline('summarization', model='facebook/bart-large-cnn', tokenizer='facebook/bart-large-cnn') ##Kernel dies after running this line

transformers version - 2.11.0
torch - 1.5.0

Can't replicate :(.
Can I see your transformers-cli env output?

How do I get that output? I'm running these on Jupyter without any virtual env

Got it.

  • transformers version: 2.11.0
  • Platform: Linux-4.14.181-108.257.amzn1.x86_64-x86_64-with-glibc2.9
  • Python version: 3.6.10
  • PyTorch version (GPU?): 1.5.0 (False)
  • Tensorflow version (GPU?): 2.2.0 (False)
  • Using GPU in script?:
  • Using distributed or parallel set-up in script?:

@sshleifer It works finally. There was a problem with GPU allocation. Thanks for your response.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

siddsach picture siddsach  路  3Comments

adigoryl picture adigoryl  路  3Comments

ereday picture ereday  路  3Comments

iedmrc picture iedmrc  路  3Comments

chuanmingliu picture chuanmingliu  路  3Comments