Class: Toy::GPT2Config

Inherits:
Object
  • Object
show all
Defined in:
lib/toy/models/toy_gpt2.rb

Overview

Hyperparameter bag. Use a class (not Hash) so Spinel sees a concrete struct with Int / Float fields.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(vocab, d_model, n_heads, d_ff, n_layers, ctx) ⇒ GPT2Config

Returns a new instance of GPT2Config.



24
25
26
27
28
29
30
31
# File 'lib/toy/models/toy_gpt2.rb', line 24

def initialize(vocab, d_model, n_heads, d_ff, n_layers, ctx)
  @vocab    = vocab
  @d_model  = d_model
  @n_heads  = n_heads
  @d_ff     = d_ff
  @n_layers = n_layers
  @ctx      = ctx
end

Instance Attribute Details

#ctxObject

Returns the value of attribute ctx.



22
23
24
# File 'lib/toy/models/toy_gpt2.rb', line 22

def ctx
  @ctx
end

#d_ffObject

Returns the value of attribute d_ff.



22
23
24
# File 'lib/toy/models/toy_gpt2.rb', line 22

def d_ff
  @d_ff
end

#d_modelObject

Returns the value of attribute d_model.



22
23
24
# File 'lib/toy/models/toy_gpt2.rb', line 22

def d_model
  @d_model
end

#n_headsObject

Returns the value of attribute n_heads.



22
23
24
# File 'lib/toy/models/toy_gpt2.rb', line 22

def n_heads
  @n_heads
end

#n_layersObject

Returns the value of attribute n_layers.



22
23
24
# File 'lib/toy/models/toy_gpt2.rb', line 22

def n_layers
  @n_layers
end

#vocabObject

Returns the value of attribute vocab.



22
23
24
# File 'lib/toy/models/toy_gpt2.rb', line 22

def vocab
  @vocab
end