MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / len2weight

Function len2weight

data/data_utils.py:316–325  ·  view source on GitHub ↗
(x, loss_reduction='square')

Source from the content-addressed store, hash-verified

314
315
316def len2weight(x, loss_reduction='square'):
317 if x == 0:
318 return x
319 if loss_reduction == 'token':
320 return 1
321 if loss_reduction == 'sample':
322 return 1 / x
323 if loss_reduction == 'square':
324 return 1 / (x ** 0.5)
325 raise NotImplementedError(loss_reduction)
326
327
328def apply_template_qwenvl2_reconThenUnd(question_with_image_tokens,answer):

Callers 2

pack_sequenceMethod · 0.85
pack_sequenceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected