modeling¶
-
class
ArtistForImageGeneration
(gpt, image_vocab_size=16384)[源代码]¶ 基类:
paddlenlp.transformers.artist.modeling.ArtistForConditionalGeneration
Artist Model with a
language modeling
head andVQGanTokenizer
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)[源代码]¶ The ArtistForImageGeneration generate method. :param input_ids: See
ArtistForConditionalGeneration
. :type input_ids: Tensor :param attention_mask: SeeArtistForConditionalGeneration
. :type attention_mask: Tensor, optional :param top_k: The number of highest probability tokens tokeep 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 ofVQGanDetokenizer
. 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 ofArtistModel
.