Skip to content

Commit fc3a30f

Browse files
authored
Merge pull request #177 from Abhishek-TAMU/prompt_fix
Fix IndexError: list index out of range when no prompt is found
2 parents 7462077 + 6466d68 commit fc3a30f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

aiu_fms_testing_utils/scripts/drive_paged_programs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ def __prepare_inputs(batch_size, seq_length, tokenizer, enforce_sizes=[], seed=0
288288
encoded = encoded[:seq_length]
289289
prompt_list.append(encoded)
290290

291+
if not prompt_list:
292+
raise ValueError(
293+
f"No valid prompt sample exists in dataset for input shape (Batch Size={batch_size}, Seq Length={seq_length})"
294+
)
291295
if len(prompt_list) < batch_size:
292296
dprint(
293297
f"You requested {batch_size} prompts but we were only able to get {len(prompt_list)} valid prompts. We will be repeating the first prompt."

0 commit comments

Comments
 (0)