AcademiaSD Max Int
Eight sockets, one winner, and the unwired ones sit it out
- max_int
- connected
Every switch node in ComfyUI makes you pick one branch. That's fine when you know which side you want, and useless when the question is "which of these numbers is biggest" - there you end up chaining If nodes or a Math node per pair and wiring a comparison ladder by hand. AcademiaSD Max Int is the reducer for that job: hand it up to eight integers, get back the largest one that's actually connected.
What it does, mechanically
The interesting part isn't the max(), it's the emptiness handling. All eight inputs, in1 through in8, are optional and forced to be sockets rather than widgets. An unwired optional input arrives at the Python function as None, so the node skips it entirely - you can leave six sockets bare and it returns the larger of the two that are live. If the author had given them default values instead, empty inputs would read as 0 and take part in the comparison, which is exactly the wrong answer.
It also drops anything that isn't a real number. Booleans in particular get filtered out, because a Python bool is an int and would sneak through as a plausible-looking 0 or 1. It prints its decision to the console each run - the values it saw and which one won - and if nothing is connected at all it says so and hands back fallback instead of guessing.
The inputs and outputs that matter
fallback- the only widget on the node. It's what comes out when no input is connected. Set it to something meaningful for your workflow: a default frame count,0if you want an obvious "nothing arrived" signal.in1…in8- the sockets. Wire in whatever INT sources you have: counters, resolution outputs, seed generators, prompt indices.max_int- the winner, asINT. Goes anywhere you'd otherwise type a number.connected- how many of the eight inputs actually participated. This is the quietly useful one: it's a tally of how many optional branches are live, so it can drive a batch size, an index, or a "did I plug in any references at all" check.
Where does a max actually earn its place? Loops. If one branch counts frames and another counts takes and a third comes from a counter file, and your sampler should run for whichever is longest, max_int is one node instead of five. Same story for steps driven by two different models, or a resolution value that has to be at least as large as some reference. And connected handles the other direction - I've used that shape to size a batch off how many LoRA slots are filled.
Installing it
It ships in comfyui_AcademiaSD, the node collection by the YouTube tutorial channel @Academia SD - Spanish-language tutorials, bilingual comments in the source, and a workflow JSON in the repo for basically every model he covers. Search comfyui_AcademiaSD in ComfyUI Manager and install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/AcademiaSD/comfyui_AcademiaSD
# then restart ComfyUI
There's no requirements.txt in the repo, and for this node that's honest - it needs nothing beyond what ComfyUI already ships (torch, numpy, Pillow, safetensors, and core's own folder_paths/node_helpers). Once loaded, it's under Academia SD/Utilities as "AcademiaSD Max Int". No model download, no token, nothing to configure.
Where people get burned
Floats get truncated, not rounded. The source does int(v), so a 2.9 arriving from something like the pack's Numeric Input node becomes 2, not 3. If your max looks one short, that's why.
It is not a switch. There's no priority and no selector - it doesn't care about order, so it can't express "use the first one that's connected". That's a fallback switch's job (rgthree's Any Switch is the canonical one). Max Int answers a numeric question, not a routing one.
Silent fallback is silent by design. If you forget to connect anything, the node doesn't error; it prints a line and returns fallback, and your workflow happily generates something with the wrong number of steps. Check the console once when you first wire it up.
Eight inputs is the ceiling. Nine sources means two nodes - the outer one takes the inner one's max_int as an input. Chain them, don't fight it.
One nice side effect of this being pure arithmetic: unlike the pack's disk-reading nodes, Max Int doesn't force itself to re-run on every queue, so it doesn't cost you cache reuse downstream. Give it inputs that haven't changed and it just returns the old answer.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| fallback | INT | 0-2147483648–2147483647 | Valor devuelto si no hay ninguna entrada conectada. / Returned when nothing is connected. |
| in1opt | INT | — | |
| in2opt | INT | — | |
| in3opt | INT | — | |
| in4opt | INT | — | |
| in5opt | INT | — | |
| in6opt | INT | — | |
| in7opt | INT | — | |
| in8opt | INT | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| max_int | INT | — |
| connected | INT | — |