Class: Transformers::DebertaV2::DebertaV2Config

Inherits:
PretrainedConfig show all
Defined in:
lib/transformers/models/deberta_v2/configuration_deberta_v2.rb

Instance Attribute Summary collapse

Attributes inherited from PretrainedConfig

#_commit_hash, #add_cross_attention, #architectures, #chunk_size_feed_forward, #id2label, #is_decoder, #is_encoder_decoder, #output_attentions, #output_hidden_states, #problem_type, #pruned_heads, #tie_encoder_decoder, #tie_word_embeddings, #tokenizer_class

Instance Method Summary collapse

Methods inherited from PretrainedConfig

#_attn_implementation, #_dict, from_dict, from_pretrained, get_config_dict, #getattr, #hasattr, #method_missing, #name_or_path, #name_or_path=, #num_labels, #num_labels=, #respond_to_missing?, #to_dict, #to_diff_dict, #to_json_string, #to_s, #use_return_dict

Methods included from ClassAttribute

#class_attribute

Constructor Details

#initialize(vocab_size: 128100, hidden_size: 1536, num_hidden_layers: 24, num_attention_heads: 24, intermediate_size: 6144, hidden_act: "gelu", hidden_dropout_prob: 0.1, attention_probs_dropout_prob: 0.1, max_position_embeddings: 512, type_vocab_size: 0, initializer_range: 0.02, layer_norm_eps: 1e-07, relative_attention: false, max_relative_positions: -1,, pad_token_id: 0, position_biased_input: true, pos_att_type: nil, pooler_dropout: 0, pooler_hidden_act: "gelu", **kwargs) ⇒ DebertaV2Config

Returns a new instance of DebertaV2Config.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 26

def initialize(
  vocab_size: 128100,
  hidden_size: 1536,
  num_hidden_layers: 24,
  num_attention_heads: 24,
  intermediate_size: 6144,
  hidden_act: "gelu",
  hidden_dropout_prob: 0.1,
  attention_probs_dropout_prob: 0.1,
  max_position_embeddings: 512,
  type_vocab_size: 0,
  initializer_range: 0.02,
  layer_norm_eps: 1e-07,
  relative_attention: false,
  max_relative_positions: -1,
  pad_token_id: 0,
  position_biased_input: true,
  pos_att_type: nil,
  pooler_dropout: 0,
  pooler_hidden_act: "gelu",
  **kwargs
)
  super(**kwargs)

  @hidden_size = hidden_size
  @num_hidden_layers = num_hidden_layers
  @num_attention_heads = num_attention_heads
  @intermediate_size = intermediate_size
  @hidden_act = hidden_act
  @hidden_dropout_prob = hidden_dropout_prob
  @attention_probs_dropout_prob = attention_probs_dropout_prob
  @max_position_embeddings = max_position_embeddings
  @type_vocab_size = type_vocab_size
  @initializer_range = initializer_range
  @relative_attention = relative_attention
  @max_relative_positions = max_relative_positions
  @pad_token_id = pad_token_id
  @position_biased_input = position_biased_input

  # Backwards compatibility
  if pos_att_type.is_a?(String)
    pos_att_type = pos_att_type.downcase.split("|").map { |x| x.strip }
  end

  @pos_att_type = pos_att_type
  @vocab_size = vocab_size
  @layer_norm_eps = layer_norm_eps

  @pooler_hidden_size = kwargs[:pooler_hidden_size] || hidden_size
  @pooler_dropout = pooler_dropout
  @pooler_hidden_act = pooler_hidden_act
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Transformers::PretrainedConfig

Instance Attribute Details

#attention_probs_dropout_probObject (readonly)

Returns the value of attribute attention_probs_dropout_prob.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def attention_probs_dropout_prob
  @attention_probs_dropout_prob
end

#hidden_actObject (readonly)

Returns the value of attribute hidden_act.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def hidden_act
  @hidden_act
end

#hidden_dropout_probObject (readonly)

Returns the value of attribute hidden_dropout_prob.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def hidden_dropout_prob
  @hidden_dropout_prob
end

#hidden_sizeObject (readonly)

Returns the value of attribute hidden_size.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def hidden_size
  @hidden_size
end

#initializer_rangeObject (readonly)

Returns the value of attribute initializer_range.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def initializer_range
  @initializer_range
end

#intermediate_sizeObject (readonly)

Returns the value of attribute intermediate_size.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def intermediate_size
  @intermediate_size
end

#layer_norm_epsObject (readonly)

Returns the value of attribute layer_norm_eps.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def layer_norm_eps
  @layer_norm_eps
end

#max_position_embeddingsObject (readonly)

Returns the value of attribute max_position_embeddings.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def max_position_embeddings
  @max_position_embeddings
end

#max_relative_positionsObject (readonly)

Returns the value of attribute max_relative_positions.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def max_relative_positions
  @max_relative_positions
end

#num_attention_headsObject (readonly)

Returns the value of attribute num_attention_heads.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def num_attention_heads
  @num_attention_heads
end

#num_hidden_layersObject (readonly)

Returns the value of attribute num_hidden_layers.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def num_hidden_layers
  @num_hidden_layers
end

#pad_token_idObject (readonly)

Returns the value of attribute pad_token_id.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def pad_token_id
  @pad_token_id
end

#pooler_dropoutObject (readonly)

Returns the value of attribute pooler_dropout.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def pooler_dropout
  @pooler_dropout
end

#pooler_hidden_actObject (readonly)

Returns the value of attribute pooler_hidden_act.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def pooler_hidden_act
  @pooler_hidden_act
end

#pooler_hidden_sizeObject (readonly)

Returns the value of attribute pooler_hidden_size.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def pooler_hidden_size
  @pooler_hidden_size
end

#pos_att_typeObject (readonly)

Returns the value of attribute pos_att_type.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def pos_att_type
  @pos_att_type
end

#position_biased_inputObject (readonly)

Returns the value of attribute position_biased_input.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def position_biased_input
  @position_biased_input
end

#relative_attentionObject (readonly)

Returns the value of attribute relative_attention.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def relative_attention
  @relative_attention
end

#type_vocab_sizeObject (readonly)

Returns the value of attribute type_vocab_size.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def type_vocab_size
  @type_vocab_size
end

#vocab_sizeObject (readonly)

Returns the value of attribute vocab_size.



20
21
22
# File 'lib/transformers/models/deberta_v2/configuration_deberta_v2.rb', line 20

def vocab_size
  @vocab_size
end