Class: Informers::BartForConditionalGeneration
- Inherits:
-
BartPretrainedModel
- Object
- PreTrainedModel
- BartPretrainedModel
- Informers::BartForConditionalGeneration
- Defined in:
- lib/informers/models.rb
Constant Summary
Constants inherited from PreTrainedModel
PreTrainedModel::MAIN_INPUT_NAME
Instance Attribute Summary
Attributes inherited from PreTrainedModel
Instance Method Summary collapse
-
#initialize(config, session, decoder_merged_session, generation_config) ⇒ BartForConditionalGeneration
constructor
A new instance of BartForConditionalGeneration.
Methods inherited from PreTrainedModel
#call, construct_session, from_pretrained, #generate
Constructor Details
#initialize(config, session, decoder_merged_session, generation_config) ⇒ BartForConditionalGeneration
851 852 853 854 855 856 857 858 859 860 861 862 863 |
# File 'lib/informers/models.rb', line 851 def initialize(config, session, decoder_merged_session, generation_config) super(config, session) @decoder_merged_session = decoder_merged_session @generation_config = generation_config @num_decoder_layers = @config["decoder_layers"] @num_decoder_heads = @config["decoder_attention_heads"] @decoder_dim_kv = @config["d_model"] / @num_decoder_heads.to_f @num_encoder_layers = @config["encoder_layers"] @num_encoder_heads = @config["encoder_attention_heads"] @encoder_dim_kv = @config["d_model"] / @num_encoder_heads end |