pyhgf.model.transformer.HybridGPT#
- class pyhgf.model.transformer.HybridGPT(tok_table, pos_table, pipeline, token_part=None, position_part=None)[source]#
The full Transformer as a mixed pipeline, from token ids to logits.
The embeddings sit outside the part contract (token ids are integers, not features). By default they are frozen lookup tables held directly. Passing
token_part/position_part(learning parts fed one-hot rows, e.g. built withfrom_embedding()) makes them learn: a lookup equals a one-hot vector times the table, so the parts see one-hot inputs and receive the error at the embedding output. The rest of the model — blocks, final normalisation, head — is onePCSequentialover(batch, seq, features)arrays.Run it with
FusedPipeline, whosestepandpredicttake batches of integer token-id sequences,(batch, seq).- Parameters:
tok_table (jnp.ndarray)
pos_table (jnp.ndarray)
pipeline (PCSequential)
- __init__(tok_table, pos_table, pipeline, token_part=None, position_part=None)[source]#
- Parameters:
tok_table (Array)
pos_table (Array)
pipeline (PCSequential)
Methods
__init__(tok_table, pos_table, pipeline[, ...])init_state()Return
(pipeline_state, token_state, position_state).