{"id":3433,"library":"comfy-kitchen","title":"Comfy Kitchen","description":"Comfy Kitchen is a fast kernel library designed for ComfyUI, offering optimized computational primitives with support for multiple compute backends such as PyTorch, JAX, and CuPy. It provides low-level, high-performance operations for AI workloads, allowing users to leverage different hardware and frameworks. The current version is 0.2.8, and it appears to follow a rapid iteration release cadence, indicating active development.","status":"active","version":"0.2.8","language":"python","source_language":"en","source_url":"https://github.com/Comfy-Org/comfy-kitchen","tags":["ComfyUI","AI","Machine Learning","Kernels","Optimization","Backend","PyTorch","JAX","CuPy"],"install":[{"cmd":"pip install comfy-kitchen","lang":"bash","label":"Base installation"},{"cmd":"pip install comfy-kitchen[torch]","lang":"bash","label":"With PyTorch backend"},{"cmd":"pip install comfy-kitchen[jax]","lang":"bash","label":"With JAX backend"},{"cmd":"pip install comfy-kitchen[cupy]","lang":"bash","label":"With CuPy backend"}],"dependencies":[{"reason":"Required for the 'torch' compute backend","package":"torch","optional":true},{"reason":"Required for the 'jax' compute backend","package":"jax","optional":true},{"reason":"Required for the 'cupy' compute backend","package":"cupy","optional":true}],"imports":[{"wrong":"import comfy-kitchen","symbol":"comfy_kitchen","correct":"import comfy_kitchen"}],"quickstart":{"code":"import comfy_kitchen.kernels as K\nimport os\n\n# --- Important: Choose and install a backend first ---\n# For this example, we default to 'torch'.\n# Ensure you have installed the corresponding extra, e.g., `pip install comfy-kitchen[torch]`\ntry:\n    backend_choice = os.environ.get('COMFY_KITCHEN_BACKEND', 'torch')\n    K.set_backend(backend_choice)\n    print(f\"Successfully set Comfy Kitchen backend to: {backend_choice}\")\n\n    # List available kernels for the selected backend\n    available_kernels = K.list_kernels()\n    print(f\"Available kernels for '{backend_choice}' backend: {', '.join(available_kernels)}\")\n\n    # Attempt to load an example kernel (e.g., a diffusion related one)\n    kernel_name = \"diffusion_forward\" # Common kernel, but might vary per version/backend\n    \n    if kernel_name in available_kernels:\n        kernel = K.load_kernel(kernel_name)\n        print(f\"Loaded kernel: {kernel.name} from backend: {K.get_backend()}\")\n        print(f\"Kernel signature (expected inputs): {kernel.signature()}\")\n        \n        # A full example would involve preparing inputs as per kernel.signature()\n        # For demonstration, we just show successful loading and signature.\n        # Example: to use, you'd prepare tensors (e.g., torch.Tensor) matching the signature\n        # output = kernel.forward(*your_prepared_tensors_here)\n        print(\"Kernel is ready for execution with appropriate input tensors.\")\n    else:\n        print(f\"Kernel '{kernel_name}' not found for backend '{backend_choice}'.\")\n\nexcept ImportError as e:\n    print(f\"ERROR: Failed to import a backend. Did you run `pip install comfy-kitchen[{backend_choice}]`? Details: {e}\")\nexcept Exception as e:\n    print(f\"An error occurred during Comfy Kitchen setup or kernel loading: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize Comfy Kitchen, set a compute backend (e.g., 'torch'), list available kernels, and load a specific kernel. It highlights the importance of installing optional backend dependencies and explicitly setting the backend before use."},"warnings":[{"fix":"Install with extras: `pip install comfy-kitchen[backend_name]` where `backend_name` is 'torch', 'jax', or 'cupy'.","message":"Comfy Kitchen relies on optional backend dependencies (e.g., 'torch', 'jax', 'cupy') which must be installed separately using pip extra commands. Attempting to use a backend without its corresponding dependency will result in an `ImportError` or runtime errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Call `K.set_backend(\"your_backend_choice\")` early in your code, after importing `comfy_kitchen.kernels`.","message":"Before loading any kernels, you must explicitly set the desired compute backend using `K.set_backend(\"torch\")` (or \"jax\", \"cupy\", etc.). The library does not default to a backend, and attempting to load kernels without this step will raise an error.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Align expectations; this library is designed for specific kernel acceleration and high-performance operations, not for managing ComfyUI workflows or interacting with its UI layer.","message":"Comfy Kitchen is a low-level kernel library providing optimized primitives. It is not a high-level wrapper for ComfyUI itself or a complete ComfyUI API client. Users might incorrectly assume it provides tools for general ComfyUI orchestration.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'0.2.8':53 'activ':65 'ai':39,68 'allow':41 'appear':56 'backend':22,73 'cadenc':63 'comfi':1,3 'comfyui':12,67 'comput':15,21 'cupi':28,76 'current':50 'design':10 'develop':66 'differ':45 'fast':7 'follow':58 'framework':48 'hardwar':46 'high':35 'high-perform':34 'indic':64 'iter':61 'jax':26,75 'kernel':8,71 'kitchen':2,4 'learn':70 'level':33 'leverag':44 'librari':9 'low':32 'low-level':31 'machin':69 'multipl':20 'offer':13 'oper':37 'optim':14,72 'perform':36 'primit':16 'provid':30 'pytorch':25,74 'rapid':60 'releas':62 'support':18 'user':42 'version':51 'workload':40","created_at":"2026-04-11T17:28:54.434973+00:00","updated_at":"2026-04-17T14:35:38.306399+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmpo588ird4/venv/lib/python3.12/site-packages/comfy_kitchen/__init__.py\", line 1, in <module>\n    import torch\nModuleNotFoundError: No module named 'torch'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.2.31","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/Comfy-Org/comfy-kitchen","docs":null,"changelog":null,"pypi":"https://pypi.org/project/comfy-kitchen/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-08-29","next_check":"2026-07-10","install_tag":null}}