Skip to content

Commit 2076bf2

Browse files
authored
get mask token from tokenizer (#2592)
1 parent 35eabb0 commit 2076bf2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

benchmarks/inference/bert-bench.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ def print_latency(latency_set, title, warmup=3):
5858
if dtype == torch.half:
5959
pipe.model.half()
6060

61-
br = pipe("Hello I'm a [MASK] model")
61+
mask = pipe.tokenizer.mask_token
62+
63+
br = pipe(f"Hello I'm a {mask} model")
6264
if args.deepspeed:
6365
pipe.model = deepspeed.init_inference(pipe.model,
6466
dtype=dtype,
@@ -74,7 +76,7 @@ def print_latency(latency_set, title, warmup=3):
7476
for i in range(args.trials):
7577
torch.cuda.synchronize()
7678
start = time.time()
77-
r = pipe("Hello I'm a [MASK] model")
79+
r = pipe(f"Hello I'm a {mask} model")
7880
torch.cuda.synchronize()
7981
end = time.time()
8082
responses.append(r)

0 commit comments

Comments
 (0)