Class: GPT2KVBlockFFI

Inherits:
Object
  • Object
show all
Defined in:
lib/toy/llm/engine/gpt2_kv_engine.rb

Overview

Per-block persistent tensor handles. Includes per-head K/V buffers alongside the standard GPT-2 weights.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGPT2KVBlockFFI

Returns a new instance of GPT2KVBlockFFI.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 34

def initialize
  @t_ln1_gamma = TinyNN.tnn_null_ptr
  @t_ln1_beta  = TinyNN.tnn_null_ptr
  @t_ln2_gamma = TinyNN.tnn_null_ptr
  @t_ln2_beta  = TinyNN.tnn_null_ptr
  @t_w_q = [TinyNN.tnn_null_ptr]
  @t_w_k = [TinyNN.tnn_null_ptr]
  @t_w_v = [TinyNN.tnn_null_ptr]
  @t_b_q = [TinyNN.tnn_null_ptr]
  @t_b_k = [TinyNN.tnn_null_ptr]
  @t_b_v = [TinyNN.tnn_null_ptr]
  @t_K   = [TinyNN.tnn_null_ptr]
  @t_V   = [TinyNN.tnn_null_ptr]
  @t_w_o   = TinyNN.tnn_null_ptr
  @t_b_o   = TinyNN.tnn_null_ptr
  @t_w_ff1 = TinyNN.tnn_null_ptr
  @t_b_ff1 = TinyNN.tnn_null_ptr
  @t_w_ff2 = TinyNN.tnn_null_ptr
  @t_b_ff2 = TinyNN.tnn_null_ptr
end

Instance Attribute Details

#t_b_ff1Object

Returns the value of attribute t_b_ff1.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_b_ff1
  @t_b_ff1
end

#t_b_ff2Object

Returns the value of attribute t_b_ff2.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_b_ff2
  @t_b_ff2
end

#t_b_kObject

Returns the value of attribute t_b_k.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_b_k
  @t_b_k
end

#t_b_oObject

Returns the value of attribute t_b_o.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_b_o
  @t_b_o
end

#t_b_qObject

Returns the value of attribute t_b_q.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_b_q
  @t_b_q
end

#t_b_vObject

Returns the value of attribute t_b_v.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_b_v
  @t_b_v
end

#t_KObject

Returns the value of attribute t_K.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_K
  @t_K
end

#t_ln1_betaObject

Returns the value of attribute t_ln1_beta.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_ln1_beta
  @t_ln1_beta
end

#t_ln1_gammaObject

Returns the value of attribute t_ln1_gamma.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_ln1_gamma
  @t_ln1_gamma
end

#t_ln2_betaObject

Returns the value of attribute t_ln2_beta.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_ln2_beta
  @t_ln2_beta
end

#t_ln2_gammaObject

Returns the value of attribute t_ln2_gamma.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_ln2_gamma
  @t_ln2_gamma
end

#t_VObject

Returns the value of attribute t_V.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_V
  @t_V
end

#t_w_ff1Object

Returns the value of attribute t_w_ff1.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_w_ff1
  @t_w_ff1
end

#t_w_ff2Object

Returns the value of attribute t_w_ff2.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_w_ff2
  @t_w_ff2
end

#t_w_kObject

Returns the value of attribute t_w_k.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_w_k
  @t_w_k
end

#t_w_oObject

Returns the value of attribute t_w_o.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_w_o
  @t_w_o
end

#t_w_qObject

Returns the value of attribute t_w_q.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_w_q
  @t_w_q
end

#t_w_vObject

Returns the value of attribute t_w_v.



26
27
28
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 26

def t_w_v
  @t_w_v
end