| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Circuit.LLM.GPT
Description
GPT-2 architecture using hmatrix for linear algebra.
Synopsis
- layerNorm :: Matrix Double -> Vector Double -> Vector Double -> Double -> Matrix Double
- gelu :: Matrix Double -> Matrix Double
- data FeedForward = FeedForward {}
- data TransformerBlock = TransformerBlock {}
- transformerBlock :: Int -> TransformerBlock -> Matrix Double -> Matrix Double
- data GptConfig = GptConfig {}
- data Gpt = Gpt {}
- forward :: GptConfig -> Gpt -> [Int] -> Matrix Double
Normalisation and activation
layerNorm :: Matrix Double -> Vector Double -> Vector Double -> Double -> Matrix Double Source #
Layer normalisation along the last axis.
Transformer block
data FeedForward Source #
Feed-forward network.
transformerBlock :: Int -> TransformerBlock -> Matrix Double -> Matrix Double Source #
Full model
GPT-2 model configuration.
GPT-2 model parameters.