Class: Informers::GPT2PreTrainedModel
- Inherits:
-
PreTrainedModel
- Object
- PreTrainedModel
- Informers::GPT2PreTrainedModel
- Defined in:
- lib/informers/models.rb
Direct Known Subclasses
Constant Summary
Constants inherited from PreTrainedModel
PreTrainedModel::MAIN_INPUT_NAME
Instance Attribute Summary collapse
-
#dim_kv ⇒ Object
readonly
Returns the value of attribute dim_kv.
-
#num_heads ⇒ Object
readonly
Returns the value of attribute num_heads.
-
#num_layers ⇒ Object
readonly
Returns the value of attribute num_layers.
Attributes inherited from PreTrainedModel
Instance Method Summary collapse
-
#initialize(config, session, generation_config) ⇒ GPT2PreTrainedModel
constructor
A new instance of GPT2PreTrainedModel.
Methods inherited from PreTrainedModel
#call, construct_session, from_pretrained, #generate
Constructor Details
#initialize(config, session, generation_config) ⇒ GPT2PreTrainedModel
Returns a new instance of GPT2PreTrainedModel.
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 |
# File 'lib/informers/models.rb', line 1050 def initialize(config, session, generation_config) super(config, session) @generation_config = generation_config # config doesn't contain pad_token_id, so we assume it is the eos_token_id @config["pad_token_id"] = @config["eos_token_id"] @num_heads = @config["n_head"] @num_layers = @config["n_layer"] @dim_kv = @config["n_embd"] / @num_heads.to_f end |
Instance Attribute Details
#dim_kv ⇒ Object (readonly)
Returns the value of attribute dim_kv.
1048 1049 1050 |
# File 'lib/informers/models.rb', line 1048 def dim_kv @dim_kv end |
#num_heads ⇒ Object (readonly)
Returns the value of attribute num_heads.
1048 1049 1050 |
# File 'lib/informers/models.rb', line 1048 def num_heads @num_heads end |
#num_layers ⇒ Object (readonly)
Returns the value of attribute num_layers.
1048 1049 1050 |
# File 'lib/informers/models.rb', line 1048 def num_layers @num_layers end |