SummarizeTemplate¶
- class torchtune.data.SummarizeTemplate[source]¶
Prompt template to format datasets for summarization tasks.
Summarize this dialogue: <YOUR DIALOGUE HERE> --- Summary:
- classmethod format(sample: Mapping[str, Any], column_map: Optional[Dict[str, str]] = None) str [source]¶
Generate prompt from dialogue.
- Parameters:
Examples
>>> # Simple dialogue >>> SummarizeTemplate.format(sample={"dialogue": "Hello, how are you? Did you know the capital of France is Paris?"}) Summarize this dialogue: Hello, how are you? Did you know the capital of France is Paris? --- Summary:
>>> # Dialogue with column map where the 'dialogue' key is actually named 'prompt' in the given sample >>> SummarizeTemplate.format( ... sample={"prompt": "Hello, how are you? Did you know the capital of France is Paris?"}, ... column_map={"dialogue": "prompt"} ... ) Summarize this dialogue: Hello, how are you? Did you know the capital of France is Paris? --- Summary:
- Returns:
The formatted prompt