Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivicai1005 committed Feb 6, 2024
1 parent a44efb7 commit 2ed9537
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions other_infer/exllamav2_hf_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def main(

device = torch.cuda.current_device()
sess_text = ""
tic = time.perf_counter()
while True:
raw_text = input(
'prompt("exit" to end, "clear" to clear session) >>> '
Expand Down Expand Up @@ -255,13 +256,15 @@ def main(
max_length=max_input_length,
)
inputs = {k: v.to(device) for k, v in inputs.items()}
print(inputs)
tic = time.perf_counter()
print('=' * 100)
for text in generate_stream(model, tokenizer, inputs['input_ids'], inputs['attention_mask'],
generation_config=generation_config):
print(text, end='', flush=True)
print('')
toc = time.perf_counter()
print(
f"\n[time: {res_time:0.4f} sec, speed: {num_tok / res_time:0.4f} tok/sec]"
)
print("=" * 100)

# generation_kwargs["streamer"] = streamer
Expand Down

0 comments on commit 2ed9537

Please sign in to comment.