Class: Transformers::Distilbert::DistilBertConfig

Inherits:
PretrainedConfig show all
Defined in:
lib/transformers/models/distilbert/configuration_distilbert.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: 30522, max_position_embeddings: 512, sinusoidal_pos_embds: false, n_layers: 6, n_heads: 12, dim: 768, hidden_dim: 4 * 768, dropout: 0.1, attention_dropout: 0.1, activation: "gelu", initializer_range: 0.02, qa_dropout: 0.1, seq_classif_dropout: 0.2, pad_token_id: 0, **kwargs) ⇒ DistilBertConfig

Returns a new instance of DistilBertConfig.



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
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 29

def initialize(
  vocab_size: 30522,
  max_position_embeddings: 512,
  sinusoidal_pos_embds: false,
  n_layers: 6,
  n_heads: 12,
  dim: 768,
  hidden_dim: 4 * 768,
  dropout: 0.1,
  attention_dropout: 0.1,
  activation: "gelu",
  initializer_range: 0.02,
  qa_dropout: 0.1,
  seq_classif_dropout: 0.2,
  pad_token_id: 0,
  **kwargs
)
  @vocab_size = vocab_size
  @max_position_embeddings = max_position_embeddings
  @sinusoidal_pos_embds = sinusoidal_pos_embds
  @n_layers = n_layers
  @n_heads = n_heads
  @dim = dim
  @hidden_dim = hidden_dim
  @dropout = dropout
  @attention_dropout = attention_dropout
  @activation = activation
  @initializer_range = initializer_range
  @qa_dropout = qa_dropout
  @seq_classif_dropout = seq_classif_dropout
  super(**kwargs, pad_token_id: pad_token_id)
end

Dynamic Method Handling

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

Instance Attribute Details

#activationObject (readonly)

Returns the value of attribute activation.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def activation
  @activation
end

#attention_dropoutObject (readonly)

Returns the value of attribute attention_dropout.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def attention_dropout
  @attention_dropout
end

#dimObject (readonly)

Returns the value of attribute dim.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def dim
  @dim
end

#dropoutObject (readonly)

Returns the value of attribute dropout.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def dropout
  @dropout
end

#hidden_dimObject (readonly)

Returns the value of attribute hidden_dim.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def hidden_dim
  @hidden_dim
end

#initializer_rangeObject (readonly)

Returns the value of attribute initializer_range.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def initializer_range
  @initializer_range
end

#max_position_embeddingsObject (readonly)

Returns the value of attribute max_position_embeddings.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def max_position_embeddings
  @max_position_embeddings
end

#n_headsObject (readonly)

Returns the value of attribute n_heads.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def n_heads
  @n_heads
end

#n_layersObject (readonly)

Returns the value of attribute n_layers.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def n_layers
  @n_layers
end

#pad_token_idObject (readonly)

Returns the value of attribute pad_token_id.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def pad_token_id
  @pad_token_id
end

#qa_dropoutObject (readonly)

Returns the value of attribute qa_dropout.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def qa_dropout
  @qa_dropout
end

#seq_classif_dropoutObject (readonly)

Returns the value of attribute seq_classif_dropout.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def seq_classif_dropout
  @seq_classif_dropout
end

#sinusoidal_pos_embdsObject (readonly)

Returns the value of attribute sinusoidal_pos_embds.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def sinusoidal_pos_embds
  @sinusoidal_pos_embds
end

#vocab_sizeObject (readonly)

Returns the value of attribute vocab_size.



25
26
27
# File 'lib/transformers/models/distilbert/configuration_distilbert.rb', line 25

def vocab_size
  @vocab_size
end