MCPcopy Create free account
hub / github.com/OpenMOSS/MOSS / build_inputs_with_special_tokens

Method build_inputs_with_special_tokens

models/tokenization_moss.py:238–249  ·  view source on GitHub ↗
(self, token_ids_0, token_ids_1=None)

Source from the content-addressed store, hash-verified

236 return word
237
238 def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None):
239 if self.add_bos_token:
240 bos_token_ids = [self.bos_token_id]
241 else:
242 bos_token_ids = []
243
244 output = bos_token_ids + token_ids_0
245
246 if token_ids_1 is None:
247 return output
248
249 return output + bos_token_ids + token_ids_1
250
251 def _tokenize(self, text):
252 """Tokenize a string."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected