Models
bert
函数式融合编程的BERT模型实现,对标huggingface
- class mindnlp.models.bert.BertAttention(config)[源代码]
基类:
CellBert Attention
- construct(input_tensor, attention_mask=None, head_mask=None)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertConfig(vocab_size=30522, hidden_size=768, num_hidden_layers=12, num_attention_heads=12, intermediate_size=3072, hidden_act='gelu', hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1, max_position_embeddings=512, type_vocab_size=2, initializer_range=0.02, layer_norm_eps=1e-12, **kwargs)[源代码]
-
BERT-base配置类
- class mindnlp.models.bert.BertEmbeddings(config)[源代码]
基类:
CellBert编码层,包括word embeddings,position embeddings和token type embeddings
- construct(input_ids, token_type_ids=None, position_ids=None)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertEncoder(config)[源代码]
基类:
CellBert Encoder
- construct(hidden_states, attention_mask=None, head_mask=None)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertForPretraining(config, *args, **kwargs)[源代码]
基类:
CellBert For Pretraining
- construct(input_ids, attention_mask=None, token_type_ids=None, position_ids=None, head_mask=None, masked_lm_positions=None)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertIntermediate(config)[源代码]
基类:
CellBert Intermediate
- construct(hidden_states)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertLMPredictionHead(config)[源代码]
基类:
CellBert LM Prediction Head
- construct(hidden_states, masked_lm_positions)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertLayer(config)[源代码]
基类:
CellBert Layer
- construct(hidden_states, attention_mask=None, head_mask=None)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertModel(config)[源代码]
基类:
CellBert Model
- construct(input_ids, attention_mask=None, token_type_ids=None, position_ids=None, head_mask=None)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertOutput(config)[源代码]
基类:
CellBert Output
- construct(hidden_states, input_tensor)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertPooler(config)[源代码]
基类:
CellBert Pooler
- construct(hidden_states)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertPreTrainingHeads(config)[源代码]
基类:
CellBert PreTraining Heads
- construct(sequence_output, pooled_output, masked_lm_positions)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertPredictionHeadTransform(config)[源代码]
基类:
CellBert Prediction Head Transform
- construct(hidden_states)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertSelfAttention(config)[源代码]
基类:
CellSelf attention layer for BERT.
- construct(hidden_states, attention_mask=None, head_mask=None)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.BertSelfOutput(config)[源代码]
基类:
CellBert Self Output
- construct(hidden_states, input_tensor)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.
- class mindnlp.models.bert.Matmul(auto_prefix=True, flags=None)[源代码]
基类:
CellMatmul Operation
- construct(a, b)[源代码]
Defines the computation to be performed. This method must be overridden by all subclasses.
备注
It is not supported currently that inputs contain both tuple and non-tuple types at same time.
- 参数
inputs (tuple) – Tuple of variable parameters.
kwargs (dict) – Dictionary of variable keyword parameters.
- 返回
Tensor, returns the computed result.