Skip to content
Snippets Groups Projects
Commit e64eaa2b authored by wu's avatar wu
Browse files

Update models.py

parent 0fcead8b
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,10 @@ class SummarisationModel(nn.Module):
for datapoint in dataset:
if len(datapoint.raw_document) == 0 or len(datapoint.raw_summary) == 0:
print("Warning in Testing! This datapoint has an empty document or an empty summary")
continue
top_indices, probs = self.__call__(datapoint.document)
r_1, r_2, r_l = utils.rouge(utils.select_elements(datapoint.raw_document, top_indices), datapoint.raw_summary, verbose=True)
running_rouge_1 += r_1
......@@ -116,7 +120,7 @@ class ActorOnlySummarisationModel(SummarisationModel):
self.optimizer.zero_grad()
for datapoint in batch:
# fix argmax error with corrupted documents with empty content
# documents with empty content!
if len(datapoint.raw_document) == 0 or len(datapoint.raw_summary) == 0:
print("Warning! This datapoint has an empty document or an empty summary")
continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment