class documentation

A model that takes an image and a mask for that image as input and returns an image. See __call__ for more information.

Method __call__ Takes an image tensor and an image mask tensor as input and returns a single image tensor as output.
Method __init__ Undocumented
Property purpose The purpose of this model.
Instance Variable _call_fn Undocumented
Instance Variable _purpose Undocumented

Inherited from ModelBase:

Method bfloat16 Moves the parameters and buffers of the underlying module to bfloat16 precision.
Method cpu Moves the parameters and buffers of the underlying module to the CPU.
Method cuda Moves the parameters and buffers of the underlying module to the GPU.
Method eval Sets the underlying module in evaluation mode.
Method float Moves the parameters and buffers of the underlying module to single precision (fp32).
Method half Moves the parameters and buffers of the underlying module to half precision (fp16).
Method to Moves and casts the parameters and buffers of the underlying module to the given device and data type.
Method train Sets the underlying module in training mode.
Instance Variable input_channels The number of input image channels of the model. E.g. 3 for RGB, 1 for grayscale.
Instance Variable output_channels The number of output image channels of the model. E.g. 3 for RGB, 1 for grayscale.
Instance Variable scale The output scale of super resolution models. E.g. 4x, 2x, 1x.
Instance Variable size_requirements Size requirements for the input image. E.g. minimum size.
Instance Variable supports_bfloat16 Whether the model supports bfloat16 precision.
Instance Variable supports_half Whether the model supports half precision (fp16).
Instance Variable tags A list of tags for the model, usually describing the size or model parameters. E.g. "64nf" or "large".
Instance Variable tiling Whether the model supports tiling.
Property architecture The architecture of the model.
Property device The device of the underlying module.
Property dtype The data type of the underlying module.
Property model The model itself: a torch.nn.Module with weights loaded in.
Instance Variable _architecture Undocumented
Instance Variable _model Undocumented
def __call__(self, image: Tensor, mask: Tensor) -> Tensor: (source)

Takes an image tensor and an image mask tensor as input and returns a single image tensor as output.

The data type (float32, float16, bfloat16) and device of the image and mask tensors must be the same as the model.

The image tensor must be a 4D tensor with shape (1, input_channels, H, W). The range of the image tensor must be [0, 1].

The mask tensor must be a 4D tensor with shape (1, 1, H, W). The width and height must be the same as image tensor. The values of the mask tensor must be either 0 (keep) or 1 (inpaint).

The output tensor will be a 4D tensor with shape (1, output_channels, H, W). The data type and device of the output tensor will be the same as the image tensor. The range of the output tensor will be [0, 1].

If the width and height of the image tensor do not satisfy the size_requirements of the model, then the image tensor will be padded to satisfy the requirements. The additional padding will be removed from the output tensor before returning it. If the image already satisfies the requirements, then no padding will be added.

def __init__(self, model: T, state_dict: StateDict, architecture: Architecture[T], purpose: Literal['Inpainting'], tags: list[str], supports_half: bool, supports_bfloat16: bool, input_channels: int, output_channels: int, size_requirements: SizeRequirements|None = None, tiling: ModelTiling = ModelTiling.SUPPORTED, call_fn: Callable[[T, Tensor, Tensor], Tensor]|None = None): (source)

Undocumented

@property
@override
purpose: Literal['Inpainting'] = (source)

The purpose of this model.

_call_fn = (source)

Undocumented

_purpose: Literal['Inpainting'] = (source)

Undocumented