Expand description
Types and utilities for handling sequences of tokens, including block creation and hashing.
Modules§
Structs§
- Partial
Token Block - Represents a partially filled block of tokens within a sequence.
- Token
Block - Represents a completed, immutable block of tokens with associated hashes.
- Token
Block Sequence - Represents a sequence of tokens, segmented into fixed-size, hashed blocks.
- Tokens
- A collection of tokens, represented as a
Vec<Token>
.
Enums§
- Token
Block Error - Errors that can occur during
PartialTokenBlock
operations.
Functions§
- compute_
hash_ v2 - Computes a hash of the data using the given seed.
Type Aliases§
- Block
Hash - A 64-bit hash computed only from the tokens within a single block.
It uses
compute_hash_v2
with theSaltHash
as the seed. - Salt
- A salt used for hashing, represented as a vector of bytes. This might encode model architecture, weights, PEFT info, etc.
- Salt
Hash - A 64-bit hash of the salt, computed using
compute_hash_v2
with a seed of 0. Used as the initial seed for subsequent block hashes. - Sequence
Hash - A 64-bit sequence-aware hash.
It combines the previous block’s
SequenceHash
(or theSaltHash
for the first block) with the current block’sBlockHash
usingcompute_hash_v2
and theSaltHash
as the seed. - Token
- A token is represented as a 32-bit unsigned integer.