MCPcopy Create free account
hub / github.com/THUDM/GLM / pad_to

Method pad_to

tasks/seq2seq/dataset.py:603–608  ·  view source on GitHub ↗
(text, max_len, pad_id)

Source from the content-addressed store, hash-verified

601 pad_id = self.tokenizer.get_command('pad').Id
602
603 def pad_to(text, max_len, pad_id):
604 if len(text) > max_len:
605 text = text[:max_len]
606 else:
607 text = text + [pad_id] * (max_len - len(text))
608 return text
609
610 source_tokens = self.tokenizer.EncodeAsIds(source_text).tokenization
611 masked_tgt = target_text.split("|")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected