salesforce / ConvSumm

BSD 3-Clause "New" or "Revised" License
38 stars 8 forks source link

Error occurs when load trained summarization models using the huggingface library. #1

Closed AsphaltC closed 3 years ago

AsphaltC commented 3 years ago

thanks for sharing this code! it seems there are some errors when using the trained model:

libc++abi.dylib: terminating with uncaught exception of type c10::Error: owning_ptr == NullType::singleton() || owning_ptr->refcount_.load() > 0 INTERNAL ASSERT FAILED at ../c10/util/intrusive_ptr.h:348, please report a bug to PyTorch. intrusive_ptr: Can only intrusive_ptr::reclaim() owning pointers that were created using intrusive_ptr::release(). (reclaim at ../c10/util/intrusive_ptr.h:348)

I use the code below(which is provided in README): from transformers import pipeline summarizer = pipeline("summarization", model="Salesforce/bart-large-xsum-samsum", device=0) text = "<s> {}".format(" <s> ".join(conv)) summary = summarizer(text, min_length=10, max_length=100, num_beams=4)[0]["summary_text"]

how can I solve this problem? thanks!

jasonwu0731 commented 3 years ago

@sysu17353013

Which PyTorch and transformers version you were using? I have never seen this error and it looks like it is not related to my source code.

Alternatively, instead of pipeline library, can you try to download the models from the huggingface manually and then use BartForConditionalGeneration.from_pretrained (similar to here)?

AsphaltC commented 3 years ago

@jasonwu0731 I am using pytorch 1.3.0 and transformers 4.6.1 Can you share your pytorch and transformers version? Or is there any other package requirements? Thanks!

jasonwu0731 commented 3 years ago

@sysu17353013

I am using python 3.6.9, torch 1.8, and transformers 4.5.1.

Are you able to run it on CPU? pipeline("summarization", model="Salesforce/bart-large-xsum-samsum")

AsphaltC commented 3 years ago

hi! I have already solved the problem with the environment, it seems that previous problems are caused by the environment, but some other errors seems to occur. https://colab.research.google.com/drive/1uRQu5D8e5OaERsxsPziIyfWh8UhSIfB8?usp=sharing#scrollTo=5btPVbqCFaK- It seems there’s something wrong with the model? Thanks!

jasonwu0731 commented 3 years ago

@sysu17353013

It seems that the tokenizer config uploaded has included the wrong root path. I have updated it there.

I run the notebook you shared and it should work now.

AsphaltC commented 3 years ago

@jasonwu0731 Thanks for your help! The model is working properly now.

BTW, what is the parameter num_beams in summary = summarizer(text, min_length=10, max_length=100, num_beams=10)[0]["summary_text"] means? What parameter should I adjust if I want to summarize long conversations?

jasonwu0731 commented 3 years ago

@sysu17353013

Happy to hear that it works from your side.

Please check the huggingface document for more details.