Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type BARTDType = 'Float
- bartDType :: SDType BARTDType
- type BARTDataType = 'DataType BARTDType
- bartDataType :: SDataType BARTDataType
- bartDropoutP :: Double
- type BARTPosEncDim = 'Dim ('Name "*") ('Size 1026)
- bartPosEncDim :: SDim BARTPosEncDim
- bartEps :: Double
- bartMaxPositionEmbeddings :: Int
- bartPadTokenId :: Int
- bartBOSTokenId :: Int
- bartEOSTokenId :: Int
- bartAttentionMaskBias :: Double
- type family BARTModelF (transformerHead :: TransformerHead) (numLayers :: Nat) (gradient :: Gradient RequiresGradient) (device :: Device (DeviceType Nat)) (headDim :: Dim (Name Symbol) (Size Nat)) (headEmbedDim :: Dim (Name Symbol) (Size Nat)) (embedDim :: Dim (Name Symbol) (Size Nat)) (inputEmbedDim :: Dim (Name Symbol) (Size Nat)) (ffnDim :: Dim (Name Symbol) (Size Nat)) (vocabDim :: Dim (Name Symbol) (Size Nat)) (hasDropout :: HasDropout) :: Type where ...
- bartModelSpec :: forall transformerHead numLayers gradient device headDim headEmbedDim embedDim inputEmbedDim ffnDim vocabDim hasDropout. (SingI headDim, SingI headEmbedDim, SingI embedDim, SingI inputEmbedDim, SingI ffnDim, SingI vocabDim) => STransformerHead transformerHead -> SNat numLayers -> SGradient gradient -> SDevice device -> SHasDropout hasDropout -> ModelSpec (BARTModelF transformerHead numLayers gradient device headDim headEmbedDim embedDim inputEmbedDim ffnDim vocabDim hasDropout)
- mkBARTInput :: forall batchDim seqDim device m output. (MonadThrow m, SGetDim batchDim, SGetDim seqDim, Catch ('Shape '['Dim ('Name "*") 'UncheckedSize, 'Dim ('Name "*") 'UncheckedSize] <+> 'Shape '[batchDim, seqDim]), output ~ Tensor ('Gradient 'WithoutGradient) ('Layout 'Dense) device ('DataType 'Int64) ('Shape '[batchDim, seqDim])) => SDim batchDim -> SDim seqDim -> SDevice device -> [[Int]] -> m output
Documentation
type BARTDataType = 'DataType BARTDType Source #
BART data type.
bartDataType :: SDataType BARTDataType Source #
BART data type singleton.
bartDropoutP :: Double Source #
BART dropout rate. 'dropout_rate = 0.1'
bartPosEncDim :: SDim BARTPosEncDim Source #
BART positional encoding dimension singleton.
bartMaxPositionEmbeddings :: Int Source #
BART maximum number of position embeddings. 'max_position_embeddings = 1024'
bartPadTokenId :: Int Source #
BART padding token id. 'pad_token_id = 1'
bartBOSTokenId :: Int Source #
BART begin-of-sentence token id. 'bos_token_id = 0'
bartEOSTokenId :: Int Source #
BART end-of-sentence token id. 'eos_token_id = 2'
bartAttentionMaskBias :: Double Source #
BART attention mask bias
type family BARTModelF (transformerHead :: TransformerHead) (numLayers :: Nat) (gradient :: Gradient RequiresGradient) (device :: Device (DeviceType Nat)) (headDim :: Dim (Name Symbol) (Size Nat)) (headEmbedDim :: Dim (Name Symbol) (Size Nat)) (embedDim :: Dim (Name Symbol) (Size Nat)) (inputEmbedDim :: Dim (Name Symbol) (Size Nat)) (ffnDim :: Dim (Name Symbol) (Size Nat)) (vocabDim :: Dim (Name Symbol) (Size Nat)) (hasDropout :: HasDropout) :: Type where ... Source #
Specifies the BART model.
BARTModelF transformerHead numLayers gradient device headDim headEmbedDim embedDim inputEmbedDim ffnDim vocabDim hasDropout = GSimplifiedEncoderDecoderTransformer (GEncoderDecoderTransformerF 'BART transformerHead numLayers numLayers gradient device BARTDataType headDim headEmbedDim embedDim inputEmbedDim ffnDim BARTPosEncDim vocabDim hasDropout) MkAbsPos MkAbsPos MkTransformerPaddingMask (MkTransformerAttentionMask BARTDataType) (MkTransformerCrossAttentionMask BARTDataType) (MkTransformerDecoderAttentionMask BARTDataType) |
bartModelSpec :: forall transformerHead numLayers gradient device headDim headEmbedDim embedDim inputEmbedDim ffnDim vocabDim hasDropout. (SingI headDim, SingI headEmbedDim, SingI embedDim, SingI inputEmbedDim, SingI ffnDim, SingI vocabDim) => STransformerHead transformerHead -> SNat numLayers -> SGradient gradient -> SDevice device -> SHasDropout hasDropout -> ModelSpec (BARTModelF transformerHead numLayers gradient device headDim headEmbedDim embedDim inputEmbedDim ffnDim vocabDim hasDropout) Source #
Specifies the parameters of a BART model.
transformerHead
: the head of the BART model.numLayers
: the number of layers in the BART model.gradient
: whether to compute the gradient of the BART model.device
: the computational device on which the BART model parameters are to be allocated.
mkBARTInput :: forall batchDim seqDim device m output. (MonadThrow m, SGetDim batchDim, SGetDim seqDim, Catch ('Shape '['Dim ('Name "*") 'UncheckedSize, 'Dim ('Name "*") 'UncheckedSize] <+> 'Shape '[batchDim, seqDim]), output ~ Tensor ('Gradient 'WithoutGradient) ('Layout 'Dense) device ('DataType 'Int64) ('Shape '[batchDim, seqDim])) => SDim batchDim -> SDim seqDim -> SDevice device -> [[Int]] -> m output Source #