8 min read
Checking batch versus single-input BERT encodings
Encode a fixture one by one and as a batch, asserting equality before padding and documenting tensor shape after padding
Read6 guides on encoding.
Encode a fixture one by one and as a batch, asserting equality before padding and documenting tensor shape after padding
ReadBatch unequal samples with padding and inspect masks and ids; explain why a CLS or SEP is attended while PAD is not
ReadCompare add_special_tokens true/false and print special_tokens_mask; distinguish content count and model-input length
ReadEncode a pair and inspect tokens and special_tokens_mask; explain the two SEP markers and counting implications
ReadDerive content-token length from the returned mask for single and paired inputs without hardcoding overhead
ReadPrint type ids aligned with actual tokens, including separator positions; describe segment roles and model-specific limits
Read