MCPcopy Create free account
hub / github.com/Monalissaa/DisenDiff / get_token_indices

Method get_token_indices

src/model.py:387–392  ·  view source on GitHub ↗
(tokens, token_id)

Source from the content-addressed store, hash-verified

385 len_add_token = len(self.cond_stage_model.modifier_token_id)
386
387 def get_token_indices(tokens, token_id):
388 indices = tokens == token_id
389 indices = (indices*1).unsqueeze(-1)
390 index_token = (indices == 1).nonzero()
391 index_token = index_token.tolist()
392 return index_token
393
394 index_token = get_token_indices(tokens, self.cond_stage_model.modifier_token_id[-len_add_token])
395 index_token_new2 = get_token_indices(tokens, self.cond_stage_model.modifier_token_id[-1])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected