MCPcopy
hub / github.com/apple/ml-mgie / _mask_targets

Function _mask_targets

mgie_train.py:246–254  ·  view source on GitHub ↗
(target, tokenized_lens, speakers)

Source from the content-addressed store, hash-verified

244
245
246def _mask_targets(target, tokenized_lens, speakers):
247 # cur_idx = 0
248 cur_idx = tokenized_lens[0]
249 tokenized_lens = tokenized_lens[1:]
250 target[:cur_idx] = IGNORE_INDEX
251 for tokenized_len, speaker in zip(tokenized_lens, speakers):
252 if speaker == "human":
253 target[cur_idx+2:cur_idx + tokenized_len] = IGNORE_INDEX
254 cur_idx += tokenized_len
255
256
257def _add_speaker_and_signal(header, source, get_conversation=True):

Callers 1

preprocessFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected