Skip to content

Commit

Permalink
Improve observability during LLM inference (#3536)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnavgarg1 authored Aug 15, 2023
1 parent 5ba3494 commit 756ddf5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ludwig/models/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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])

Expand Down

0 comments on commit 756ddf5

Please sign in to comment.