modeling

class ArtistModel(vocab_size, 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=16, initializer_range=0.02, pad_token_id=0, eos_token_id=7, bos_token_id=0, eol_token_id=3, topo=None)[源代码]

基类:paddlenlp.transformers.gpt.modeling.GPTModel

class ArtistForImageGeneration(gpt, image_vocab_size=16384)[源代码]

基类:paddlenlp.transformers.artist.modeling.ArtistForConditionalGeneration

Artist Model with a language modeling head and VQGanTokenizer on top. :param gpt: An instance of ArtistModel. :type gpt: ArtistModel :param image_vocab_size: The vocabulary size of image.

Defaults to 16384.

generate(input_ids, attention_mask=None, top_k=0, top_p=1.0, temperature=1.0, num_return_sequences=1, use_faster=False, use_fp16_decoding=False, **kwargs)[源代码]

The ArtistForImageGeneration generate method. :param input_ids: See ArtistForConditionalGeneration. :type input_ids: Tensor :param attention_mask: See ArtistForConditionalGeneration. :type attention_mask: Tensor, optional :param top_k: The number of highest probability tokens to

keep for top-k-filtering in the "sampling" strategy. Default to 0, which means no effect.

参数
  • top_p (float, optional) -- The cumulative probability for top-p-filtering in the "sampling" strategy. The value should satisfy \(0 <= top\_p < 1\). Default to 1.0, which means no effect.

  • temperature (float, optional) -- The value used to module the next token probabilities in the "sampling" strategy. Default to 1.0, which means no effect.

  • num_return_sequences (int, optional) -- The number of returned sequences for each sequence in the batch. Default to 1.

  • use_faster -- (bool, optional): Whether to use faster entry of model for FasterGeneration. Default to False.

  • use_fp16_decoding -- (bool, optional): Whether to use fp16 for decoding. Only works when faster entry is avalible. Default to False.

返回

Returns tensor images, which is the output of VQGanDetokenizer. Its data type should be uint8 and has a shape of [batch_size, num_return_sequences, 256, 256, 3].

返回类型

Tensor

示例

class ArtistForConditionalGeneration(gpt)[源代码]

基类:paddlenlp.transformers.gpt.modeling.GPTLMHeadModel

The ArtistT(GPT) Model with a language modeling head on top.

参数

gpt (ArtistModel) -- An instance of ArtistModel.