modeling#

class ProphetNetModel(config: ProphetNetConfig)[源代码]#

基类:ProphetNetPretrainedModel

get_input_embeddings()[源代码]#

get input embedding of model

返回:

embedding of model

返回类型:

nn.Embedding

set_input_embeddings(value)[源代码]#

set new input embedding for model

参数:

value (Embedding) -- the new embedding of model

抛出:

NotImplementedError -- Model has not implement set_input_embeddings method

forward(input_ids=None, attention_mask=None, decoder_input_ids=None, decoder_attention_mask=None, encoder_output: Tuple | None = None, use_cache=True, past_key_values=None)[源代码]#

Defines the computation performed at every call. Should be overridden by all subclasses.

参数:
  • *inputs (tuple) -- unpacked tuple arguments

  • **kwargs (dict) -- unpacked dict arguments

class ProphetNetPretrainedModel(*args, **kwargs)[源代码]#

基类:PretrainedModel

An abstract class for pretrained Prophetnet models. It provides Prophetnet related model_config_file, pretrained_init_configuration, resource_files_names, pretrained_resource_files_map, base_model_prefix for downloading and loading pretrained models.

config_class#

ProphetNetConfig 的别名

base_model_class#

ProphetNetModel 的别名

class ProphetNetEncoder(word_embeddings, config: ProphetNetConfig)[源代码]#

基类:ProphetNetPretrainedModel

word_embeddings (paddle.nn.Embeddings of shape (config.vocab_size, config.hidden_size), optional):

The word embedding parameters. This can be used to initialize ProphetNetEncoder with pre-defined word embeddings instead of randomly initialized word embeddings.

forward(input_ids=None, attention_mask=None)[源代码]#

Defines the computation performed at every call. Should be overridden by all subclasses.

参数:
  • *inputs (tuple) -- unpacked tuple arguments

  • **kwargs (dict) -- unpacked dict arguments

class ProphetNetDecoder(word_embeddings, config: ProphetNetConfig)[源代码]#

基类:ProphetNetPretrainedModel

forward(input_ids=None, attention_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, past_key_values=None, use_cache=True)[源代码]#

Defines the computation performed at every call. Should be overridden by all subclasses.

参数:
  • *inputs (tuple) -- unpacked tuple arguments

  • **kwargs (dict) -- unpacked dict arguments

class ProphetNetForConditionalGeneration(config: ProphetNetConfig)[源代码]#

基类:ProphetNetPretrainedModel

forward(input_ids=None, attention_mask=None, decoder_input_ids=None, decoder_attention_mask=None, encoder_output=None, labels=None, use_cache=True, past_key_values=None)[源代码]#

Defines the computation performed at every call. Should be overridden by all subclasses.

参数:
  • *inputs (tuple) -- unpacked tuple arguments

  • **kwargs (dict) -- unpacked dict arguments