From 720c6475d98fa761f6557114e152022a0308084a Mon Sep 17 00:00:00 2001 From: Eldar Kurtic Date: Tue, 21 May 2024 13:27:32 +0200 Subject: [PATCH] Fix Platypus template when there are no inputs (additional one) PR is doing the same thing as https://github.com/neuralmagic/sparseml/pull/2296 (just in one more location in the codebase which I have missed in the first pass) --- src/sparseml/transformers/finetune/data/open_platypus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sparseml/transformers/finetune/data/open_platypus.py b/src/sparseml/transformers/finetune/data/open_platypus.py index 20bdda98fb4..47078ba8969 100644 --- a/src/sparseml/transformers/finetune/data/open_platypus.py +++ b/src/sparseml/transformers/finetune/data/open_platypus.py @@ -56,7 +56,7 @@ def get_raw_dataset(self, cache_dir: Optional[str] = None): # helper fn for restructuring each dataset entry using the alpaca template def restructure_fn(sample): - if "input" in sample: + if "input" in sample and sample["input"] != "": sample["text"] = self.ALPACA_TEMPLATE["prompt_input"].format( instruction=sample["instruction"], input=sample["input"] )