Class: GPT2Config
- Inherits:
-
Object
- Object
- GPT2Config
- 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
-
#context_length ⇒ Object
Returns the value of attribute context_length.
-
#d_ff ⇒ Object
Returns the value of attribute d_ff.
-
#d_model ⇒ Object
Returns the value of attribute d_model.
-
#ln_eps ⇒ Object
Returns the value of attribute ln_eps.
-
#n_heads ⇒ Object
Returns the value of attribute n_heads.
-
#n_layers ⇒ Object
Returns the value of attribute n_layers.
-
#vocab_size ⇒ Object
Returns the value of attribute vocab_size.
Instance Method Summary collapse
-
#initialize(vocab_size, d_model, d_ff, n_heads, n_layers, context_length, ln_eps) ⇒ GPT2Config
constructor
A new instance of GPT2Config.
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_length ⇒ Object
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_ff ⇒ Object
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_model ⇒ Object
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_eps ⇒ Object
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_heads ⇒ Object
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_layers ⇒ Object
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_size ⇒ Object
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 |