""" Generic native executor for SGLang Diffusion ComfyUI integration. Runs models directly through ComfyUI without SGLang when no SGLang pipeline exists for the model type. The forward pass is delegated to the ComfyUI-loaded diffusion model. """ from .base import SGLDiffusionExecutor class NativeExecutor(SGLDiffusionExecutor): """Generic native executor for unsupported SGLang model types. Bypasses SGLang entirely and calls the ComfyUI diffusion model directly. This allows SGLDUNETLoader to load any model type without requiring an SGLang pipeline. """ def __init__(self, generator, model_path, model, config, native_diffusion_model): super().__init__(generator, model_path, model, config) # Break circular nn.Module reference: # comfyui_model.diffusion_model → NativeExecutor (self) # NativeExecutor.model → comfyui_model (set by base class) # Deregister 'model' from _modules so state_dict() won't infinitely recurse. if 'model' in self._modules: del self._modules['model'] # Register native_diffusion_model normally so its weights are visible # to ComfyUI's dynamic VRAM loading. self.native_diffusion_model = native_diffusion_model def set_lora(self, lora_nickname=None, lora_path=None, strength=None, target=None): """LoRA not supported in native mode.""" pass def forward(self, *args, **kwargs): """Forward pass: delegate directly to the ComfyUI diffusion model.""" return self.native_diffusion_model(*args, **kwargs)