sketchkit.colorization.manga_ninja.manganinja package

Subpackages

Submodules

sketchkit.colorization.manga_ninja.manganinja.pipeline module

class sketchkit.colorization.manga_ninja.manganinja.pipeline.MangaNinjiaPipeline(reference_unet: RefUNet2DConditionModel, controlnet: ControlNetModel, denoising_unet: UNet2DConditionModel, vae: AutoencoderKL, refnet_tokenizer: CLIPTokenizer, refnet_text_encoder: CLIPTextModel, refnet_image_encoder: CLIPVisionModelWithProjection, controlnet_tokenizer: CLIPTokenizer, controlnet_text_encoder: CLIPTextModel, controlnet_image_encoder: CLIPVisionModelWithProjection, scheduler: DDIMScheduler, point_net: PointNet)[source]

Bases: DiffusionPipeline

__encode_empty_text()

Encode text embedding for empty prompt

decode_RGB(rgb_latent: Tensor) Tensor[source]

Decode depth latent into depth map.

Parameters:

rgb_latent (torch.Tensor) – Depth latent to be decoded.

Returns:

Decoded depth map.

Return type:

torch.Tensor

encode_RGB(rgb_in: Tensor, generator) Tensor[source]

Encode RGB image into latent.

Parameters:

rgb_in (torch.Tensor) – Input RGB image to be encoded.

Returns:

Image latent.

Return type:

torch.Tensor

get_timesteps(num_inference_steps, strength, device, denoising_start=None)[source]
rgb_latent_scale_factor = 0.18215
single_infer(is_lineart: bool, ref1: Tensor, raw2: Tensor, edit2: Tensor, num_inference_steps: int, show_pbar: bool, guidance_scale_ref: float, guidance_scale_point: float, refnet_encoder_hidden_states: Tensor, controlnet_encoder_hidden_states: Tensor, reference_control_writer: ReferenceAttentionControl, reference_control_reader: ReferenceAttentionControl, preprocessor, generator, point_ref, point_main)[source]
class sketchkit.colorization.manga_ninja.manganinja.pipeline.MangaNinjiaPipelineOutput[source]

Bases: BaseOutput

img_np: ndarray
img_pil: Image
to_save_dict: dict

sketchkit.colorization.manga_ninja.manganinja.point_network module

class sketchkit.colorization.manga_ninja.manganinja.point_network.PointNet(conditioning_channels: int = 1, out_channels: Tuple[int] = (320, 640, 1280, 1280), downsamples: Tuple[int] = (6, 2, 2, 2))[source]

Bases: ModelMixin

forward(x)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Module contents