Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions prompting/conversation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import random
from transformers import Pipeline
from prompting.tasks import Task, TASKS, TranslationPipeline, TranslationTask
from prompting.tasks import Task, TASKS, TranslationPipeline, TranslationTask, SummarizationTask
from prompting.tools import Selector, DATASETS
from prompting.task_registry import TASK_REGISTRY

Expand Down Expand Up @@ -42,7 +42,10 @@ def create_task(
if dataset is None:
raise ValueError(f"Dataset {dataset_name} not found")
else:
dataset = dataset()
if task_name == SummarizationTask.name:
dataset = dataset(selector='all')
else:
dataset = dataset()

if task_name == TranslationTask.name:
return task(
Expand Down
15 changes: 10 additions & 5 deletions prompting/tools/datasets/wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,18 @@ def get(
)
if not sections:
return None

key = header, section_title = selector(list(sections.keys()))
content = "\n".join(sections[key])
section_length = len(content.split())
if selector == 'all':
content = "\n".join(["\n".join(section) for section in sections.values()])
section_length = len(content.split())
topic = "All Sections"
else:
key = header, section_title = selector(list(sections.keys()))
content = "\n".join(sections[key])
section_length = len(content.split())
topic = header or section_title
context = {
"title": name, # title of wiki article
"topic": header or section_title, # title of wiki section
"topic": topic, # title of wiki section
"subtopic": section_title,
"content": content,
"internal_links": list(filter(lambda x: x not in exclude, page.sections)),
Expand Down