transformers>=5.0.0rc0 torch>=2.0.0 huggingface_hub>=0.23.0 Pillow numpy accelerate bitsandbytes>=0.41.0 scipy
This is the transformer-based implementation of Niutonian GLM-4.6V nodes for ComfyUI with extensive memory optimizations to prevent CUDA out-of-memory errors.
Version: v0.1
Loads the GLM-4.6V-Flash model with memory optimizations.
Inputs:
device: auto/cuda/cpu (default: auto)torch_dtype: auto/bfloat16/float16/float32 (default: bfloat16)low_cpu_mem_usage: Enable low CPU memory usage (default: True)load_in_8bit: Enable 8-bit quantization (default: False)load_in_4bit: Enable 4-bit quantization (default: True)Outputs:
GLM_MODEL: Model and processor for other nodesDescribes images using the GLM-4.6V vision model.
Inputs:
glm_model: Model from Niutonian GLM46VLoaderimage: Input image tensoruser_prompt: Description prompt (default: “Describe this image in detail.”)max_tokens: Maximum output tokens (default: 1024)temperature: Sampling temperature (default: 0.7)Outputs:
output_text: Clean description textraw_output: Raw model output with thinking tagsAdvanced KSampler that uses GLM-4.6V to verify generated images.
Inputs:
glm_model: GLM model for verificationvae: VAE for decoding latentsverification_prompt: Prompt for image verificationmax_retries: Maximum retry attempts (default: 3)Outputs:
latent: Final latent representationverified_image: Decoded imageis_match: Boolean indicating if image matches promptsummary: Analysis summaryIntelligent prompt generator using GLM-4.6V vision model.
Inputs:
glm_model: Model from Niutonian GLM46VLoadermode: Generation mode (create_from_image, refine_prompt, creative_variations, style_transfer)base_prompt: Base prompt text for refinement modesstyle: Target artistic style (photorealistic, artistic, cinematic, anime, etc.)detail_level: Level of detail (basic, detailed, very_detailed, ultra_detailed)creativity: Creativity factor (0.0-1.0)max_tokens: Maximum output tokensreference_image: Optional reference imagenegative_elements: Elements to avoid in promptsOutputs:
positive_prompt: Generated positive promptnegative_prompt: Generated negative promptanalysis: Analysis of prompt choicesEnable 4-bit or 8-bit quantization to significantly reduce VRAM usage:
device_map="sequential" for efficient GPU memory allocationcustom_nodes directory:cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/Niutonian/comfyui_Niutonian_GLM_4_6V.git
cd comfyui_Niutonian_GLM_4_6V
pip install -r requirements.txt
torch_dtype="float16"low_cpu_mem_usage=Truetorch_dtype="float16"torch_dtype="bfloat16"torch_dtype="bfloat16" for best performancetorch_dtype="float16" if bfloat16 causes issuesmax_tokens in Niutonian GLM46VDescriberIf the image is generated but appears grey or not showing properly:
Run the memory test script to validate your setup:
python test_memory.py
This will test different quantization configurations and report memory usage.
This package is part of the Niutonian suite of AI tools, providing professional-grade implementations of cutting-edge AI models for creative workflows.
Version: v0.1
Release Date: January 5, 2026
Repository: Niutonian/comfyui_Niutonian_GLM_4_6V
See CHANGELOG.md for detailed version history and changes.