paraphernalia.torch.dall_e module

Generate images with the discrete VAE component of DALL-E.

class DALL_E(tau=1.0, hard=False, start=None, **kwargs)[source]

Image generator based on OpenAI’s release of the discrete VAE component of DALL-E. Many parameters can be overridden via method arguments, so are best considered defaults.

Parameters
  • start – Determines how to intitialize the hidden state.

  • tau (Optional[float]) –

tau

Gumbel softmax temperature parameter. Larger values make the underlying distribution more uniform.

Type

float

hard

If true, then samples will be exactly one-hot

Type

bool

forward(z=None, tau=None, hard=None)[source]

Generate a batch of images.

Returns

An image batch tensor

Return type

Tensor

encode(img)[source]

Encode an image or tensor.

Parameters

img (Union[PIL.Image.Image, torch.Tensor]) –