MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / run

Function run

examples/pytorch/bert/bert_example.py:287–298  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

285 iterations = 100
286
287 def run():
288 t40 = timeit.default_timer()
289 for i in range(iterations):
290 ft_output = custom_encoder(ft_inp, ft_mask, ft_mem_seq_lens)[0] * ft_output_mask
291 t4 = timeit.default_timer() - t40
292 if rank == 0:
293 diff = torch.abs(hf_output - ft_output)
294 print('FT Mean diff: {}'.format(torch.mean(diff)))
295 print('FT Max diff: {}'.format(torch.max(diff)))
296 print('FT Min diff: {}'.format(torch.min(diff)))
297 print("[INFO] batch_size {} max_seq_len {} {} layer FT-OP-time {:6.2f} ms with {} threads".format(batch_size,
298 seq_len, layer_num, t4, thread_num))
299
300 for i in range(thread_num):
301 thread_list.append(threading.Thread(target=run, name="RunFT"))

Callers

nothing calls this directly

Calls 2

maxMethod · 0.80
minMethod · 0.80

Tested by

no test coverage detected