Class: Informers::MBartForCausalLM

Inherits:
MBartPreTrainedModel show all
Defined in:
lib/informers/models.rb

Constant Summary

Constants inherited from PreTrainedModel

PreTrainedModel::MAIN_INPUT_NAME

Instance Attribute Summary collapse

Attributes inherited from PreTrainedModel

#config

Instance Method Summary collapse

Methods inherited from PreTrainedModel

#call, construct_session, from_pretrained, #generate

Constructor Details

#initialize(config, decoder_merged_session, generation_config) ⇒ MBartForCausalLM

Returns a new instance of MBartForCausalLM.



882
883
884
885
886
887
888
889
890
891
892
893
# File 'lib/informers/models.rb', line 882

def initialize(config, decoder_merged_session, generation_config)
  super(config, 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.to_f
end

Instance Attribute Details

#decoder_dim_kvObject (readonly)

Returns the value of attribute decoder_dim_kv.



879
880
881
# File 'lib/informers/models.rb', line 879

def decoder_dim_kv
  @decoder_dim_kv
end

#encoder_dim_kvObject (readonly)

Returns the value of attribute encoder_dim_kv.



879
880
881
# File 'lib/informers/models.rb', line 879

def encoder_dim_kv
  @encoder_dim_kv
end

#num_decoder_headsObject (readonly)

Returns the value of attribute num_decoder_heads.



879
880
881
# File 'lib/informers/models.rb', line 879

def num_decoder_heads
  @num_decoder_heads
end

#num_decoder_layersObject (readonly)

Returns the value of attribute num_decoder_layers.



879
880
881
# File 'lib/informers/models.rb', line 879

def num_decoder_layers
  @num_decoder_layers
end

#num_encoder_headsObject (readonly)

Returns the value of attribute num_encoder_heads.



879
880
881
# File 'lib/informers/models.rb', line 879

def num_encoder_heads
  @num_encoder_heads
end

#num_encoder_layersObject (readonly)

Returns the value of attribute num_encoder_layers.



879
880
881
# File 'lib/informers/models.rb', line 879

def num_encoder_layers
  @num_encoder_layers
end