summaryrefslogtreecommitdiff
path: root/gpt2/config.go
diff options
context:
space:
mode:
authorJonas Knobloch <jonas.knobloch@t-online.de>2026-04-04 21:43:38 +0200
committerJonas Knobloch <jonas.knobloch@t-online.de>2026-04-04 21:43:38 +0200
commita96c1bf68bf5c477e1d3f105c18346c80d80b47a (patch)
tree88e2d5cfb53d870c9febb5b26a1351aea4bb7028 /gpt2/config.go
parent758e27cf2b3714588af7db1f5da057b15995ba26 (diff)
Add config struct
Diffstat (limited to 'gpt2/config.go')
-rw-r--r--gpt2/config.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/gpt2/config.go b/gpt2/config.go
new file mode 100644
index 0000000..b7cede5
--- /dev/null
+++ b/gpt2/config.go
@@ -0,0 +1,25 @@
+package gpt2
+
+type Config struct {
+ vocabSize int
+ nLayers int
+ nHeads int
+ headDim int
+ nPositions int
+}
+
+func NewDefaultConfig() Config {
+ return Config{
+ vocabSize: 50257,
+ nLayers: 12,
+ nHeads: 12,
+ headDim: 64,
+ nPositions: 1024,
+ }
+}
+
+func (c Config) WithVocabSize(vocabSize int) Config {
+ c.vocabSize = vocabSize
+
+ return c
+}