Nodes/ComfyUI-EMALightning/EMA Lightning Loader
ComfyUI Node

EMA Lightning Loader

The EMA Lightning Loader

By hiroki-abe-58·Created about 22 hours ago·Updated about 16 hours ago· 0
EMA Lightning Loader
    • model
    ◄model▾►
    ◄devicecuda►
    ◄batch_sizeauto►
    ◄lightningfalse►

    Most loader nodes in ComfyUI exist so you can tell it which 6 GB file to cram into VRAM. This one doesn't. EMA Lightning is a Turkish text-to-speech model - an 8.6M-parameter flow-matching acoustic model plus its vocoder - and the entire thing is about 34 MB. It still asks you three real questions: which device, how many sentences to batch, and whether you want the CUDA-graph fast path.

    If you came here expecting an English TTS loader, turn around. That's Kokoro for speed, Chatterbox for quality, and the audio landscape has the rest of the decision tree. This loader exists for one narrow, genuinely underserved case: you want Turkish speech, generated locally, inside the graph.

    What it actually does

    It builds a small dict of choices - folder, device, batch size, lightning on/off - and hands it to the next node as a custom EMA_LIGHTNING_MODEL value. That's the whole node. It doesn't read ema.pt the moment the graph runs.

    The weights load lazily, the first time an actual speech node asks for them, and then the official ema-lightning package spins up a background scheduler thread that keeps the model resident for the rest of the session. Loaded objects are cached per model folder, device and lightning setting, so a second TTS node sharing the same loader is basically free.

    Two consequences: the loader is fast and the first speech render is slow, and batch_size is deliberately not part of that cache key - it gets reassigned on every call - so fiddling with it reconfigures the running model rather than reloading it.

    The four inputs

    model is a dropdown of folders in models/ema_lightning/, and the pack only lists a folder if it contains both ema.pt and decoder.pt. If the list is empty, that's your answer: the download script hasn't run, or ran somewhere else.

    device is cuda or cpu. CPU is real here - around six times faster than real time on a decent chip, per the author's own measurement, and the model is small enough that this isn't a heroic fallback. Set it wrong and you get a ValueError, not a silent CPU fallback.

    batch_size is where the sharp edge lives. The options are auto plus 1 through 128, and they control how many sentences or audio windows the package's scheduler processes at once. auto doesn't mean "pick something sensible" - it means the package measures throughput once per device and caches the result in ~/.cache/ema_lightning. The author saw one measurement come back as 128 and another, on a fresh install of the same RTX 5090, as 8. Measured throughput isn't a stable number, so the audio shifts very slightly with it (worst case around 1e-3). If you need the same waveform on your machine and your collaborator's, pick a fixed size and stop trusting auto.

    lightning is the package's fast mode: it records CUDA graphs once per session, which took the author about 158 seconds the first time, after which a 7.9-second announcement rendered in 12 ms. It's GPU-only, off by default, and it is not bit-identical to the plain path. It also flips on cuDNN benchmark mode for the entire ComfyUI process, which means it can quietly change how your other models behave in the same session. Leave it off unless you're producing a lot of speech in one sitting.

    Output and install

    One output, model, type EMA_LIGHTNING_MODEL, and it goes into exactly one place: the EMA Lightning Text to Speech node from the same pack. There's nothing to preview and nothing else to wire it into.

    cd ComfyUI/custom_nodes
    git clone https://github.com/hiroki-abe-58/ComfyUI-EMALightning
    python -m pip install -r ComfyUI-EMALightning/requirements.txt
    python ComfyUI-EMALightning/tools/download_model.py --models-dir ../models/ema_lightning
    

    The requirements file is one line: ema-lightning==1.1.2, which pulls in the Turkish normalizer as a dependency. Nothing else heavy, no PyAV, no transformers stack to break your other packs. The download script pins the revision the pack was verified against and checks SHA-256 on every file; --verify-only re-checks without downloading anything. Keep files elsewhere by adding an ema_lightning key to extra_model_paths.yaml.

    When it doesn't show up

    Older ComfyUI is the big one. The pack is written against the newer backend node API (from comfy_api.latest import io), and its __init__.py catches the import failure, logs [EMA Lightning] not loaded: ... and registers zero nodes. So the symptom is an empty node search with a one-line explanation sitting in your console - check there before you start reinstalling things. The author tested on v0.38.0; Python 3.11+ is required by both the package and the normalizer.

    Then the usual: cuda selected with no CUDA available throws, and lightning combined with device: cpu throws, because compiled CUDA graphs need a GPU. Both fail loudly, which is the right behavior.

    Categoryloaders/ema_lightning

    Inputs (4)

    NameTypeDefaultDescription
    modelCOMBOA folder in models/ema_lightning with ema.pt and decoder.pt
    deviceCOMBOcudaThe CPU also works, about 6x faster than real time.
    batch_sizeCOMBOautoHow many sentences or audio windows the package's scheduler runs at once. auto = the package's default (measured once per device and cached by the package; the measured value can vary between installs). The audio can differ very slightly (about 1e-3) between batch sizes when a text needs more audio windows than the batch holds; pick a fixed size for audio that repeats everywhere.
    lightningBOOLEANfalseThe package's fast CUDA-graph mode, recorded once per session (minutes the first time). Not bit-identical to the plain path (the package accepts up to 1e-2), and it switches on cuDNN benchmark mode for the whole ComfyUI process.

    Outputs (1)

    NameTypeDescription
    modelEMA_LIGHTNING_MODEL—