Skip to content

Commit

Permalink
Add flag to run inference with partial dataset (#1420)
Browse files Browse the repository at this point in the history
  • Loading branch information
pramodkumar-habanalabs authored Oct 17, 2024
1 parent 4d33a13 commit 0b981a9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/text-generation/run_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ def setup_parser(parser):
action="store_true",
help="Whether to enable inputs_embeds or not.",
)
parser.add_argument(
"--run_partial_dataset",
action="store_true",
help="Run the inference with dataset for specified --n_iterations(default:5)",
)

args = parser.parse_args()

Expand Down Expand Up @@ -698,6 +703,8 @@ def generate_dataset(batch):
f"Output: {tokenizer.batch_decode(outputs, skip_special_tokens=True)[:args.batch_size*args.num_return_sequences]}"
)
print(separator)
if args.run_partial_dataset and args.n_iterations == i + 1:
break
t_end = time.time()

throughput = total_new_tokens_generated / duration
Expand Down

0 comments on commit 0b981a9

Please sign in to comment.