From 07f4b1b7597f9a562f8b54c6f3519426606701f5 Mon Sep 17 00:00:00 2001 From: Victor Sanh Date: Sun, 3 Jul 2022 19:12:52 +0000 Subject: [PATCH 1/2] fix empty documents - multi_news --- .../templates/multi_news/templates.yaml | 48 ++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/promptsource/templates/multi_news/templates.yaml b/promptsource/templates/multi_news/templates.yaml index 23fffa212..42f327601 100644 --- a/promptsource/templates/multi_news/templates.yaml +++ b/promptsource/templates/multi_news/templates.yaml @@ -3,7 +3,9 @@ templates: 12269bd1-1c3a-4865-9702-892782b593d9: !Template answer_choices: null id: 12269bd1-1c3a-4865-9702-892782b593d9 - jinja: '{% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", + jinja: '{% if document != "" %} + + {% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", "") | list %} What are the key points across these news articles: @@ -17,7 +19,9 @@ templates: ||| - {{summary[2:]}}' + {{summary[2:]}} + + {% endif %}' metadata: !TemplateMetadata choices_in_prompt: false metrics: @@ -29,7 +33,9 @@ templates: 940d0ce4-c1ef-4453-a47b-1abaaf811160: !Template answer_choices: null id: 940d0ce4-c1ef-4453-a47b-1abaaf811160 - jinja: '{% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", + jinja: '{% if document != "" %} + + {% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", "") | list %} Synthesize these documents into a single one: @@ -43,7 +49,9 @@ templates: ||| - {{summary[2:]}}' + {{summary[2:]}} + + {% endif %}' metadata: !TemplateMetadata choices_in_prompt: false metrics: @@ -55,7 +63,9 @@ templates: 9ab370ad-2b89-4d2a-bb40-ccc31accefad: !Template answer_choices: null id: 9ab370ad-2b89-4d2a-bb40-ccc31accefad - jinja: '{% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", + jinja: '{% if document != "" %} + + {% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", "") | list %} I want to edit the following articles into a more concise summary: @@ -69,7 +79,9 @@ templates: ||| - {{summary[2:]}}' + {{summary[2:]}} + + {% endif %}' metadata: !TemplateMetadata choices_in_prompt: false metrics: @@ -81,7 +93,9 @@ templates: b15485f5-2bd9-4ed4-98ce-4b241a341f99: !Template answer_choices: null id: b15485f5-2bd9-4ed4-98ce-4b241a341f99 - jinja: '{% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", + jinja: '{% if document != "" %} + + {% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", "") | list %} Write a summary of the following articles: @@ -95,7 +109,9 @@ templates: ||| - {{summary[2:]}}' + {{summary[2:]}} + + {% endif %}' metadata: !TemplateMetadata choices_in_prompt: false metrics: @@ -107,7 +123,9 @@ templates: bc910e51-c0a9-473c-aa85-adcab21b9ba9: !Template answer_choices: null id: bc910e51-c0a9-473c-aa85-adcab21b9ba9 - jinja: '{% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", + jinja: '{% if document != "" %} + + {% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", "") | list%} Write an expanded news article with plausible details from the following summary: @@ -116,7 +134,9 @@ templates: ||| - {{docs | choice}}' + {{docs | choice}} + + {% endif %}' metadata: !TemplateMetadata choices_in_prompt: false metrics: @@ -128,7 +148,9 @@ templates: d5a4bb2a-634a-4e9a-9f1f-b0803894ca0f: !Template answer_choices: null id: d5a4bb2a-634a-4e9a-9f1f-b0803894ca0f - jinja: '{% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", + jinja: '{% if document != "" %} + + {% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", "") | list %} I''m trying to distill these articles down into one: @@ -142,7 +164,9 @@ templates: ||| - {{summary[2:]}}' + {{summary[2:]}} + + {% endif %}' metadata: !TemplateMetadata choices_in_prompt: false metrics: From 917e700c4ef9fef379cf910f99a63e0f9bd7a619 Mon Sep 17 00:00:00 2001 From: Victor Sanh Date: Sun, 3 Jul 2022 19:20:49 +0000 Subject: [PATCH 2/2] fix test - unrecognized variable --- .../templates/multi_news/templates.yaml | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/promptsource/templates/multi_news/templates.yaml b/promptsource/templates/multi_news/templates.yaml index 42f327601..66b6af0d3 100644 --- a/promptsource/templates/multi_news/templates.yaml +++ b/promptsource/templates/multi_news/templates.yaml @@ -3,11 +3,11 @@ templates: 12269bd1-1c3a-4865-9702-892782b593d9: !Template answer_choices: null id: 12269bd1-1c3a-4865-9702-892782b593d9 - jinja: '{% if document != "" %} - - {% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", + jinja: '{% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", "") | list %} + {% if document != "" %} + What are the key points across these news articles: {% for doc in docs %} @@ -33,11 +33,11 @@ templates: 940d0ce4-c1ef-4453-a47b-1abaaf811160: !Template answer_choices: null id: 940d0ce4-c1ef-4453-a47b-1abaaf811160 - jinja: '{% if document != "" %} - - {% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", + jinja: '{% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", "") | list %} + {% if document != "" %} + Synthesize these documents into a single one: {% for doc in docs %} @@ -63,11 +63,11 @@ templates: 9ab370ad-2b89-4d2a-bb40-ccc31accefad: !Template answer_choices: null id: 9ab370ad-2b89-4d2a-bb40-ccc31accefad - jinja: '{% if document != "" %} - - {% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", + jinja: '{% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", "") | list %} + {% if document != "" %} + I want to edit the following articles into a more concise summary: {% for doc in docs %} @@ -93,11 +93,11 @@ templates: b15485f5-2bd9-4ed4-98ce-4b241a341f99: !Template answer_choices: null id: b15485f5-2bd9-4ed4-98ce-4b241a341f99 - jinja: '{% if document != "" %} - - {% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", + jinja: '{% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", "") | list %} + {% if document != "" %} + Write a summary of the following articles: {% for doc in docs %} @@ -123,11 +123,11 @@ templates: bc910e51-c0a9-473c-aa85-adcab21b9ba9: !Template answer_choices: null id: bc910e51-c0a9-473c-aa85-adcab21b9ba9 - jinja: '{% if document != "" %} - - {% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", + jinja: '{% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", "") | list%} + {% if document != "" %} + Write an expanded news article with plausible details from the following summary: {{summary[2:]}} @@ -148,11 +148,11 @@ templates: d5a4bb2a-634a-4e9a-9f1f-b0803894ca0f: !Template answer_choices: null id: d5a4bb2a-634a-4e9a-9f1f-b0803894ca0f - jinja: '{% if document != "" %} - - {% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", + jinja: '{% set docs = document.split("3ed2dface8203c4c9dfb1a5dc58e41e0||") | reject("equalto", "") | list %} + {% if document != "" %} + I''m trying to distill these articles down into one: {% for doc in docs %}