GrammarErrorCorrectionTemplate¶
- class torchtune.data.GrammarErrorCorrectionTemplate[source]¶
Prompt template for grammar correction datasets.
Correct this to standard English: <YOUR SENTENCE HERE> --- Corrected:
- classmethod format(sample: Mapping[str, Any], column_map: Optional[Dict[str, str]] = None) str [source]¶
Generate prompt from sentence.
- Parameters:
Examples
>>> # Simple sentence >>> GrammarErrorCorrectionTemplate.format(sample={"sentence": "The quik brown fox jumps the lazy dog"}) Correct this to standard English: The quik brown fox jumps the lazy dog --- Corrected:
>>> # Sentence with column map where the 'sentence' key is actually named 'input' in the given sample >>> GrammarErrorCorrectionTemplate.format( ... sample={"input": "The quik brown fox jumps the lazy dog"}, ... column_map={"sentence": "input"} ... ) Correct this to standard English: The quik brown fox jumps the lazy dog --- Corrected:
- Returns:
The formatted prompt