atulkum / pointer_summarizer

pytorch implementation of "Get To The Point: Summarization with Pointer-Generator Networks"
Apache License 2.0
907 stars 242 forks source link

how to predict single line after training #40

Open Lanme opened 5 years ago

Lanme commented 5 years ago

I have trained model for chinese weibo data ,how could i predict single line?

crystal0913 commented 5 years ago

Just modify the function decode() in decode.py and remove the batcher in __init__ Example:

def decode(self, article):
         example = Example(article, [], self._vocab)
         b = [example for _ in range(self.batch_size)]
         batch = Batch(b, self._vocab, self.batch_size)
         # Run beam search to get best Hypothesis
         best_summary = self.beam_search(batch)
         ......
niuweicai commented 4 years ago

Just modify the function decode() in decode.py and remove the batcher in __init__ Example:

def decode(self, article):
         example = Example(article, [], self._vocab)
         b = [example for _ in range(self.batch_size)]
         batch = Batch(b, self._vocab, self.batch_size)
         # Run beam search to get best Hypothesis
         best_summary = self.beam_search(batch)
         ......

hello,Can you share the changed code?

gaozhiguang commented 3 years ago

Hi, have you being sucessful in predict the single line, i am recently working on my graduation project which requiring a display system of automatic summarization.