MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / is_start_piece

Function is_start_piece

codegeex/megatron/data/dataset_utils.py:163–169  ·  view source on GitHub ↗

Check if the current word piece is the starting piece (BERT).

(piece)

Source from the content-addressed store, hash-verified

161
162
163def is_start_piece(piece):
164 """Check if the current word piece is the starting piece (BERT)."""
165 # When a word has been split into
166 # WordPieces, the first token does not have any marker and any subsequence
167 # tokens are prefixed with ##. So whenever we see the ## token, we
168 # append it to the previous set of word indexes.
169 return not piece.startswith("##")
170
171
172def create_masked_lm_predictions(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected