MCPcopy Index your code
hub / github.com/NVIDIA/TensorRT-LLM / parse_one_bwa

Function parse_one_bwa

examples/utils.py:263–274  ·  view source on GitHub ↗
(row)

Source from the content-addressed store, hash-verified

261 bwa = ast.literal_eval(bwa) # parse again for string
262
263 def parse_one_bwa(row):
264 assert isinstance(row, list), f"Beam width array must be a list."
265 assert len(
266 row
267 ) <= 8, "Length of beam width array must not be greater than 8 now."
268 assert all([isinstance(beam, int) for beam in row
269 ]), "Numbers in beam width array must be integer."
270 bwa_tensor = torch.zeros([8], dtype=torch.int32)
271 for j in range(len(row)):
272 bwa_tensor[j] = row[j]
273 bwa_tensor[len(row):] = row[-1]
274 return bwa_tensor, max(row)
275
276 if isinstance(bwa, list): # Only one BWA
277 bwa_tensor, max_beam_width = parse_one_bwa(bwa)

Callers 1

get_beam_width_arrayFunction · 0.85

Calls 1

maxFunction · 0.85

Tested by

no test coverage detected