Class: GPT2Config

Inherits:
Object
  • Object
show all
Defined in:
lib/toy/io/gguf_load.rb

Overview

GPT-2 hyperparameters read from the GGUF’s kv metadata. Same shape (50257 vocab, 1024 ctx) across all variants; only d_model / d_ff / n_heads / n_layers change. The converter writes these keys directly via gguf.GGUFWriter (see prep/convert_distilgpt2_to_gguf.py).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(vocab_size, d_model, d_ff, n_heads, n_layers, context_length, ln_eps) ⇒ GPT2Config

Returns a new instance of GPT2Config.



25
26
27
28
29
30
31
32
33
34
# File 'lib/toy/io/gguf_load.rb', line 25

def initialize(vocab_size, d_model, d_ff, n_heads, n_layers,
               context_length, ln_eps)
  @vocab_size     = vocab_size
  @d_model        = d_model
  @d_ff           = d_ff
  @n_heads        = n_heads
  @n_layers       = n_layers
  @context_length = context_length
  @ln_eps         = ln_eps
end

Instance Attribute Details

#context_lengthObject

Returns the value of attribute context_length.



22
23
24
# File 'lib/toy/io/gguf_load.rb', line 22

def context_length
  @context_length
end

#d_ffObject

Returns the value of attribute d_ff.



22
23
24
# File 'lib/toy/io/gguf_load.rb', line 22

def d_ff
  @d_ff
end

#d_modelObject

Returns the value of attribute d_model.



22
23
24
# File 'lib/toy/io/gguf_load.rb', line 22

def d_model
  @d_model
end

#ln_epsObject

Returns the value of attribute ln_eps.



22
23
24
# File 'lib/toy/io/gguf_load.rb', line 22

def ln_eps
  @ln_eps
end

#n_headsObject

Returns the value of attribute n_heads.



22
23
24
# File 'lib/toy/io/gguf_load.rb', line 22

def n_heads
  @n_heads
end

#n_layersObject

Returns the value of attribute n_layers.



22
23
24
# File 'lib/toy/io/gguf_load.rb', line 22

def n_layers
  @n_layers
end

#vocab_sizeObject

Returns the value of attribute vocab_size.



22
23
24
# File 'lib/toy/io/gguf_load.rb', line 22

def vocab_size
  @vocab_size
end