From 756ddf5fefc009935ce2c5ec2609abcf9594e091 Mon Sep 17 00:00:00 2001 From: Arnav Garg <106701836+arnavgarg1@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:51:46 +0300 Subject: [PATCH] Improve observability during LLM inference (#3536) --- ludwig/models/llm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ludwig/models/llm.py b/ludwig/models/llm.py index f26228413fb..df438bf37ef 100644 --- a/ludwig/models/llm.py +++ b/ludwig/models/llm.py @@ -398,7 +398,7 @@ def generate( input_ids_sample_no_padding = remove_left_padding(input_ids_sample, self.tokenizer) logger.info( "Decoded text inputs for the first example in batch: " - f"{self.tokenizer.decode(input_ids_sample_no_padding[0])}" + f"{self.tokenizer.decode(input_ids_sample_no_padding[0], skip_special_tokens=True)}" ) if input_ids_sample_no_padding.shape[1] > self.max_input_length: @@ -422,6 +422,10 @@ def generate( return_dict_in_generate=True, output_scores=True, ) + logger.info( + "Decoded generated output for the first example in batch: " + f"{self.tokenizer.batch_decode(model_outputs.sequences, skip_special_tokens=True)[0]}" + ) sequences_list.append(model_outputs.sequences[0])