Class: GPT2KVStepResult

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

Overview

Single-step graph artefacts. Returned by build_decode_step so the caller can upload the token_id input and download the logits.

Init-param names deliberately differ from the ivar names to dodge Spinel’s whole-program local-name collapse (e.g. ‘t_logits` as a param could unify with `t_logits` locals elsewhere and box the slot as sp_RbVal — breaks the (void *) cast in download_row_major).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tok_ptr, logits_ptr) ⇒ GPT2KVStepResult

Returns a new instance of GPT2KVStepResult.



268
269
270
271
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 268

def initialize(tok_ptr, logits_ptr)
  @t_token_id     = tok_ptr
  @kv_step_logits = logits_ptr
end

Instance Attribute Details

#kv_step_logitsObject

Returns the value of attribute kv_step_logits.



267
268
269
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 267

def kv_step_logits
  @kv_step_logits
end

#t_token_idObject

Returns the value of attribute t_token_id.



267
268
269
# File 'lib/toy/llm/engine/gpt2_kv_engine.rb', line 267

def t_token_id
  @t_token_id
end