dmmiller612 / bert-extractive-summarizer

Easy to use extractive text summarization with BERT
MIT License
1.39k stars 305 forks source link

Somewhat different result between online demo and python code. #50

Open directv00 opened 4 years ago

directv00 commented 4 years ago

I experimented some korean text to two scenarios but gained different results. One is online demo site https://smrzr.io/ and the other is the python code with 'distilbert-base-uncased' or "multilingual-base-cased'

body= "KT 위즈의 '수호신' 이대은이 두 경기 연속 무너졌다. 10일 잠실 두산 베어스전에서 연장 10회말 오재일에게 동점포를 맞은데 이어, 12일 창원 NC 다이노스전에서 나성범에게 동점 투런포를 내주면서 고개를 떨궜다. 시즌 첫 블론세이브를 기록한 뒤 마운드에 오른 12일 이대은의 부담감은 상당해 보였다. 팀이 6-4로 리드한 9회말 선두 타자 권희동에게 안타를 내주고, 폭투로 진루를 허용했다. 장타를 의식해 낮은 제구를 가져가려 했지만, 어깨에 지나치게 힘이 들어간 모습을 보였다. KT 이강철 감독이 직접 마운드에 올라 이대은을 달랬고, 이대은은 박민우, 이명기를 차례로 범타 처리하며 아웃카운트를 추가했다. 하지만 2B2S 유리한 카운트에서 뿌린 포크볼이 나성범의 방망이를 피하지 못한 채 악몽을 되풀이 했다. 지난해 KT 입단 후 선발로 출발했던 이대은은 시즌 중반 마무리로 전향했다. 제구 불안을 드러내기도 했지만, 후반기부터 안정감을 찾으면서 17세이브를 올려 팀의 5강 경쟁에 힘을 보탰다. 하지만 올 시즌 초반 또다시 제구 불안을 드러내면서 불안하게 출발하고 있다."

Online demo gave a summarized result correctly: summary = "KT 위즈의 '수호신 ' 이대은이 두 경기 연속 무너졌다 . 장타를 의식해 낮은 제구를 가져가려 했지만 , 어깨에 지나치게 힘이 들어간 모습을 보였다 ." But the python code gave a result same as an input. What went wrong?

Hellscream64 commented 4 years ago

Yeah i encountert the same Problem,, In google colab the distillbert and the distillbert version fo the website provided different results

dmmiller612 commented 4 years ago

Interesting. The online version uses a ratio of 0.15 and is on an older version of the library. If you provide a ratio of 0.15 is it still a problem?

directv00 commented 4 years ago

Unfortunately, it is same with ratio 0.15. Could you check it out the python code?

from transformers import * from summarizer import Summarizer

custom_model = DistilBertModel.from_pretrained('distilbert-base-multilingual-cased', output_hidden_states=True) custom_tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-multilingual-cased')

body = ''' KT 위즈의 '수호신' 이대은이 두 경기 연속 무너졌다. 10일 잠실 두산 베어스전에서 연장 10회말 오재일에게 동점포를 맞은데 이어, 12일 창원 NC 다이노스전에서 나성범에게 동점 투런포를 내주면서 고개를 떨궜다. 시즌 첫 블론세이브를 기록한 뒤 마운드에 오른 12일 이대은의 부담감은 상당해 보였다. 팀이 6-4로 리드한 9회말 선두 타자 권희동에게 안타를 내주고, 폭투로 진루를 허용했다. 장타를 의식해 낮은 제구를 가져가려 했지만, 어깨에 지나치게 힘이 들어간 모습을 보였다. KT 이강철 감독이 직접 마운드에 올라 이대은을 달랬고, 이대은은 박민우, 이명기를 차례로 범타 처리하며 아웃카운트를 추가했다. 하지만 2B2S 유리한 카운트에서 뿌린 포크볼이 나성범의 방망이를 피하지 못한 채 악몽을 되풀이 했다. 지난해 KT 입단 후 선발로 출발했던 이대은은 시즌 중반 마무리로 전향했다. 제구 불안을 드러내기도 했지만, 후반기부터 안정감을 찾으면서 17세이브를 올려 팀의 5강 경쟁에 힘을 보탰다. 하지만 올 시즌 초반 또다시 제구 불안을 드러내면서 불안하게 출발하고 있다. ''' model = Summarizer(model=bert_model, custom_model=custom_model, custom_tokenizer=custom_tokenizer) result = model(body, min_length=60, ratio=0.15) full = ''.join(result) print(full)

Tsotne001 commented 4 years ago

Same problem here. Is there any update regarding this? I've tried using different language, but still.