Class: Informers::WhisperForConditionalGeneration

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

Constant Summary collapse

REQUIRES_ATTENTION_MASK =
false
MAIN_INPUT_NAME =
:input_features

Instance Attribute Summary

Attributes inherited from PreTrainedModel

#config

Instance Method Summary collapse

Methods inherited from PreTrainedModel

#call, construct_session, from_pretrained

Constructor Details

#initialize(config, session, decoder_merged_session, generation_config) ⇒ WhisperForConditionalGeneration

Returns a new instance of WhisperForConditionalGeneration.



1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
# File 'lib/informers/models.rb', line 1102

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.to_f
end

Instance Method Details

#generate(inputs, generation_config = nil, logits_processor = nil) ⇒ Object

Raises:



1116
1117
1118
# File 'lib/informers/models.rb', line 1116

def generate(inputs, generation_config = nil, logits_processor = nil)
  raise Todo
end