class ArtistModel(config: paddlenlp.transformers.gpt.configuration.GPTConfig)[source]

Bases: paddlenlp.transformers.gpt.modeling.GPTModel

class ArtistForImageGeneration(gpt, image_vocab_size=16384)[source]

Bases: 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_fast=False, use_fp16_decoding=False, **kwargs)[source]

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_fast – (bool, optional): Whether to use fast entry of model for FastGeneration. Default to False.

  • use_fp16_decoding – (bool, optional): Whether to use fp16 for decoding. Only works when fast 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].

Return type



class ArtistForConditionalGeneration(gpt)[source]

Bases: paddlenlp.transformers.gpt.modeling.GPTLMHeadModel

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


gpt (ArtistModel) – An instance of ArtistModel.