### LanPaint Sampler Custom Integration with Custom Sigmas Source: https://context7.com/scraed/lanpaint/llms.txt Example ComfyUI workflow configuration for the LanPaint Sampler Custom node, demonstrating integration with custom sigmas and samplers. It specifies required inputs and shows how to link nodes like KarrasScheduler and KSamplerSelect to the LanPaint_SamplerCustom node. ```python # ComfyUI workflow configuration for LanPaint Sampler Custom # Node: LanPaint_SamplerCustom # Required inputs: # - model: MODEL # - add_noise: BOOLEAN (default: True) # - noise_seed: INT # - cfg: FLOAT (default: 8.0) # - positive: CONDITIONING # - negative: CONDITIONING # - sampler: SAMPLER - Custom sampler from ComfyUI # - sigmas: SIGMAS - Custom sigma schedule # - latent_image: LATENT # - LanPaint_NumSteps: INT (default: 5) # - LanPaint_PromptMode: ENUM # Returns: (output LATENT, denoised_output LATENT) # Example integration with custom sigmas: { "nodes": [ { "type": "KarrasScheduler", "outputs": [{"name": "SIGMAS", "links": [1]}] }, { "type": "KSamplerSelect", "widgets_values": ["euler"], "outputs": [{"name": "SAMPLER", "links": [2]}] }, { "type": "LanPaint_SamplerCustom", "inputs": [ {"name": "sampler", "link": 2}, {"name": "sigmas", "link": 1} ], "widgets_values": [ true, # add_noise 12345, # noise_seed 8.0, # cfg 5, # LanPaint_NumSteps "Image First" # LanPaint_PromptMode ] } ] } ``` -------------------------------- ### LanPaint Node Workflow Example (JSON) Source: https://context7.com/scraed/lanpaint/llms.txt An example of a node-based workflow for image inpainting using LanPaint. This JSON structure defines nodes for loading an image, decoding with VAE, and applying the LanPaint mask blend for smooth edge blending. It specifies input images, masks, and blending parameters. ```json { "nodes": [ { "type": "LoadImage", "widgets_values": ["input_with_mask.png"], "outputs": [ {"name": "IMAGE", "links": [1, 3]}, {"name": "MASK", "links": [2, 4]} ] }, { "type": "VAEDecode", "inputs": [ {"name": "samples", "link": "lanpaint_output"}, {"name": "vae", "link": "vae_link"} ], "outputs": [{"name": "IMAGE", "links": [5]}] }, { "type": "LanPaint_MaskBlend', "inputs": [ {"name": "image1", "link": 3}, # Original {"name": "image2", "link": 5}, # Inpainted {"name": "mask", "link": 4} ], "widgets_values": [9] # blend_overlap (smooth edges) } ] } ``` -------------------------------- ### Configure LanPaint KSampler Node in ComfyUI Source: https://context7.com/scraed/lanpaint/llms.txt This Python code snippet demonstrates how to configure the basic LanPaint KSampler node within a ComfyUI workflow for image inpainting. It outlines the required inputs and provides an example of widget values for a typical setup, including seed, steps, CFG scale, sampler, scheduler, and LanPaint-specific parameters like `LanPaint_NumSteps` and `LanPaint_PromptMode`. ```python # ComfyUI workflow configuration for LanPaint KSampler # Node: LanPaint_KSampler # Required inputs: # - model: MODEL - The diffusion model for denoising # - seed: INT - Random seed (0 to 0xffffffffffffffff) # - steps: INT - Denoising steps (default: 30, range: 1-10000) # - cfg: FLOAT - Classifier-Free Guidance scale (default: 5.0) # - sampler_name: ENUM - Sampler type (recommended: "euler") # - scheduler: ENUM - Noise schedule (default: "karras") # - positive: CONDITIONING - Positive prompt conditioning # - negative: CONDITIONING - Negative prompt conditioning # - latent_image: LATENT - Input latent with noise mask # - denoise: FLOAT - Denoising strength (default: 1.0) # - LanPaint_NumSteps: INT - Thinking iterations per step (default: 5) # - LanPaint_PromptMode: ENUM - "Image First" or "Prompt First" # - Inpainting_mode: ENUM - "Image Inpainting" or "Video Inpainting" # Example workflow setup: { "nodes": [ { "type": "LanPaint_KSampler", "widgets_values": [ 0, # seed "fixed", # seed control mode 30, # steps 5, # cfg "euler", # sampler_name "karras", # scheduler 1, # denoise 5, # LanPaint_NumSteps (turns of thinking) "Image First", # LanPaint_PromptMode "LanPaint KSampler info text" ] } ] } ``` -------------------------------- ### LanPaint Sampler Custom Advanced Configuration with CFG Guider Source: https://context7.com/scraed/lanpaint/llms.txt Example ComfyUI workflow configuration for the LanPaint Sampler Custom Advanced node, highlighting its flexibility with the guider system. This node offers full parameter control for advanced workflows and requires inputs like noise, guider, sampler, sigmas, and latent image, along with all LanPaint parameters. ```python # ComfyUI workflow configuration for LanPaint Sampler Custom Advanced # Node: LanPaint_SamplerCustomAdvanced # Required inputs: # - noise: NOISE - Noise generator # - guider: GUIDER - CFG guider with model and conditioning # - sampler: SAMPLER - Sampling algorithm # - sigmas: SIGMAS - Sigma schedule # - latent_image: LATENT # - All LanPaint parameters (NumSteps, Lambda, StepSize, etc.) # Example with CFG guider: { "nodes": [ { "type": "BasicGuider", "inputs": [ {"name": "model", "link": "model_link"}, {"name": "conditioning", "link": "cond_link"} ], "outputs": [{"name": "GUIDER", "links": [10]}] }, { "type": "RandomNoise", "widgets_values": [42], "outputs": [{"name": "NOISE", "links": [11]}] }, { "type": "LanPaint_SamplerCustomAdvanced", "inputs": [ {"name": "noise", "link": 11}, {"name": "guider", "link": 10}, {"name": "sampler", "link": "sampler_link"}, {"name": "sigmas", "link": "sigmas_link"}, {"name": "latent_image", "link": "latent_link"} ], "widgets_values": [ 5, # LanPaint_NumSteps 16.0, # LanPaint_Lambda 0.2, # LanPaint_StepSize 1.0, # LanPaint_Beta 15.0, # LanPaint_Friction "Image First", # LanPaint_PromptMode 1, # LanPaint_EarlyStop "Info", # LanPaint_Info 0.0, # LanPaint_InnerThreshold 1 # LanPaint_InnerPatience ] } ] } ``` -------------------------------- ### LanPaint Core Algorithm Initialization and Usage (Python) Source: https://context7.com/scraed/lanpaint/llms.txt Demonstrates how to initialize and use the core LanPaint class for inpainting. It requires a diffusion model wrapper and several parameters to control the Langevin dynamics process. The `lanpaint` method performs a single diffusion step, taking noisy latents, original latents, masks, and noise levels as input. ```python # Core algorithm usage (internal API) from src.LanPaint.lanpaint import LanPaint # Initialize LanPaint with parameters lanpaint = LanPaint( Model=inner_model, # The diffusion model wrapper NSteps=5, # Number of thinking iterations Friction=15.0, # Langevin friction parameter Lambda=16.0, # Bidirectional guidance strength Beta=1.0, # Masked/unmasked step ratio StepSize=0.2, # Base step size IS_FLUX=False, # True for Flux models IS_FLOW=False, # True for other flow models EarlyStopThreshold=0.0, # Semantic distance threshold EarlyStopPatience=1, # Consecutive steps below threshold EarlyStopHook=None # Custom distance function ) # Execute inpainting for a single diffusion step # Parameters: # - x: Current noisy latent (x_t in diffusion notation) # - latent_image: Original clean latent for masked regions # - noise: Random noise tensor # - sigma: Current noise level # - latent_mask: Binary mask (1 = known region, 0 = inpaint region) # - current_times: Tuple of (VE_Sigma, alpha_bar_t, Flow_t) # - model_options: Dict of model configuration # - seed: Random seed output = lanpaint( x=noisy_latent, latent_image=original_latent, noise=random_noise, sigma=current_sigma, latent_mask=mask_tensor, current_times=(VE_Sigma, abt, Flow_t), model_options={}, seed=42 ) # Returns: Denoised latent with inpainted content ``` -------------------------------- ### Configure LanPaint KSampler Advanced Node in ComfyUI Source: https://context7.com/scraed/lanpaint/llms.txt This Python code snippet details the configuration for the advanced LanPaint KSampler node in ComfyUI, offering fine-grained control over Langevin dynamics parameters. It explains key parameters like `LanPaint_NumSteps`, `LanPaint_Lambda`, `LanPaint_StepSize`, `LanPaint_Beta`, `LanPaint_Friction`, and `LanPaint_EarlyStop`, along with their recommended ranges and effects on the inpainting process. ```python # ComfyUI workflow configuration for LanPaint KSampler Advanced # Node: LanPaint_KSamplerAdvanced # Key parameters and their effects: # - LanPaint_NumSteps (0-100): Thinking iterations per denoising step # Easy tasks: 2-5, Hard tasks: 5-10 # - LanPaint_Lambda (0.1-50.0): Content alignment strength # Higher = stricter alignment with known regions, may cause instability # Recommended: 4.0-10.0 # - LanPaint_StepSize (0.0001-1.0): Langevin dynamics step size # Higher = faster convergence but less stable # Recommended: 0.1-0.5 # - LanPaint_Beta (0.0001-5.0): Step size ratio masked/unmasked # Lower values compensate for high Lambda values # Recommended: 1.0 # - LanPaint_Friction (0.0-50.0): Langevin dynamics friction # Higher = slower but more stable convergence # Recommended: 10.0-20.0 # - LanPaint_EarlyStop (0-10000): Stop iterations early # Helps prevent artifacts, Recommended: 1-5 ``` -------------------------------- ### Video Inpainting Configuration (JSON) Source: https://context7.com/scraed/lanpaint/llms.txt Configuration for video inpainting using LanPaint with Wan 2.2 models. This JSON snippet shows the settings for the LanPaint_KSampler node, including parameters like seed, steps, CFG, and importantly, `LanPaint_NumSteps` set to 2 for video processing and `Inpainting_mode` set to 'Video Inpainting' to enable 5D tensor processing for temporal consistency. ```json { "type": "LanPaint_KSampler", "widgets_values": [ 42, # seed "fixed", 20, # steps (lower for video) 5.0, # cfg "euler", "karras", 1.0, # denoise 2, # LanPaint_NumSteps (2 for video) "Image First", "Video inpainting", "Video Inpainting" # Inpainting_mode - enables 5D processing ] } ``` -------------------------------- ### LanPaint Sampler Custom Configuration Source: https://context7.com/scraed/lanpaint/llms.txt Configuration for the LanPaint Sampler Custom node in ComfyUI. This node allows integration with custom sigma schedules and samplers while retaining LanPaint's thinking capabilities. It requires various inputs like model, noise settings, conditioning, sampler, sigmas, and latent image. ```json { "type": "LanPaint_KSamplerAdvanced", "widgets_values": [ "enable", # add_noise 42, # noise_seed 50, # steps 7.0, # cfg "euler", # sampler_name "karras", # scheduler 0, # start_at_step 10000, # end_at_step "disable", # return_with_leftover_noise 10, # LanPaint_NumSteps - more thinking for hard tasks 16.0, # LanPaint_Lambda 0.2, # LanPaint_StepSize 1.0, # LanPaint_Beta 15.0, # LanPaint_Friction "Image First", # LanPaint_PromptMode 3, # LanPaint_EarlyStop "Info text", # LanPaint_Info "Image Inpainting", # Inpainting_mode 0.0, # LanPaint_InnerThreshold (0.0 disables) 1 # LanPaint_InnerPatience ] } ``` -------------------------------- ### LanPaint Mask Blend Node Configuration Source: https://context7.com/scraed/lanpaint/llms.txt Configuration details for the LanPaint Mask Blend node in ComfyUI. This post-processing node is used to blend an original image with an inpainted result based on a mask. It ensures that unmasked regions precisely match the original image, incorporating smooth transitions. ```python # ComfyUI workflow configuration for LanPaint Mask Blend # Node: LanPaint_MaskBlend # Required inputs: # - image1: IMAGE - Original image before inpainting # - image2: IMAGE - Inpainted result image ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.