MicroGPT.ts - a conversion of Karpathy's MicroGPT to Typescript
    Preparing search index...

    Function createStateDict

    • Create and randomly initialize a state dict (all model parameters) for a GPT with the given configuration and vocabulary size.

      Parameters

      • vocabSize: number

        Total number of unique tokens (including the BOS token).

      • config: GPTConfig

        Model hyperparameters.

      • rng: SeededRandom

        Seeded random number generator.

      • std: number = 0.08

        Standard deviation for weight initialization (default 0.08).

      Returns { params: Value[]; stateDict: StateDict }

      An object containing stateDict and a flat params array.