Files
Niutonian 438d1cf98e Initial release v0.1 - Niutonian GLM-4.6V ComfyUI Nodes
- Added Niutonian GLM46VLoader with memory optimizations
- Added Niutonian GLM46VDescriber for image analysis
- Added Niutonian GLM46VAgenticSampler with verification
- Added Niutonian GLM46VPromptGenerator with multiple modes
- Implemented 4-bit/8-bit quantization support
- Added comprehensive error handling and temp file management
- Professional Niutonian branding throughout
2026-01-05 12:36:51 +01:00

62 lines
2.3 KiB
Python

import sys
import subprocess
import pkg_resources
__version__ = "0.1"
def install_requirements():
"""Install required packages for Niutonian GLM-4.6V transformer version"""
required_packages = [
'transformers>=5.0.0rc0',
'torch>=2.0.0',
'huggingface_hub>=0.23.0',
'Pillow',
'numpy',
'accelerate',
'bitsandbytes>=0.41.0',
'scipy'
]
# Special handling for transformers prerelease
try:
import transformers
version = transformers.__version__
print(f"Current transformers version: {version}")
if not version.startswith('5.'):
print("Niutonian GLM-4.6V requires transformers 5.0.0rc0+. Installing prerelease...")
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "--pre", "transformers"])
except ImportError:
print("Installing transformers prerelease for Niutonian GLM-4.6V support...")
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "--pre", "transformers"])
for package in required_packages:
try:
pkg_name = package.split('>=')[0].split('==')[0]
__import__(pkg_name)
except ImportError:
print(f"Niutonian GLM-4.6V: Installing {package}...")
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
except subprocess.CalledProcessError as e:
print(f"Warning: Failed to install {package}: {e}")
# Install requirements on import
install_requirements()
from .glm_nodes import GLM46VLoader, GLM46VDescriber, GLM46VAgenticSampler, GLM46VPromptGenerator
NODE_CLASS_MAPPINGS = {
"NiutonianGLM46VLoader": GLM46VLoader,
"NiutonianGLM46VDescriber": GLM46VDescriber,
"NiutonianGLM46VAgenticSampler": GLM46VAgenticSampler,
"NiutonianGLM46VPromptGenerator": GLM46VPromptGenerator,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"NiutonianGLM46VLoader": "Niutonian GLM-4.6V Model Loader",
"NiutonianGLM46VDescriber": "Niutonian GLM-4.6V Image Describer",
"NiutonianGLM46VAgenticSampler": "Niutonian GLM-4.6V Agentic Sampler",
"NiutonianGLM46VPromptGenerator": "Niutonian GLM-4.6V Prompt Generator",
}
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "__version__"]