TextDecoder constructor

TextDecoder({
  1. required int vocabSize,
  2. required int maxSeqLen,
  3. required int embedSize,
  4. int numLayers = 4,
  5. int numHeads = 4,
})

Implementation

TextDecoder({
  required this.vocabSize,
  required this.maxSeqLen,
  required this.embedSize,
  int numLayers = 4,
  int numHeads = 4,
}) : wte = Tensor.random([vocabSize, embedSize], scale: 0.02),
     wpe = Tensor.random([maxSeqLen, embedSize], scale: 0.02),
     blocks = List.generate(
       numLayers,
       (i) => TextDecoderBlock(embedSize, numHeads, maxSeqLen),
     ),
     finalLayerNorm = LayerNorm(embedSize),
     lmHead = Layer(
       embedSize,
       vocabSize,
       useGelu: false,
     );