Nodes/ComfyUI-Pt-Wrapper/Ptd Exponential
ComfyUI Node

Ptd Exponential

Waiting times and decay, as a distribution object

By HowToSD·Created about a year ago·Updated about a year ago· 7
Ptd Exponential
    • PTDISTRIBUTION
    rate

    The Exponential distribution models time between events in a Poisson process - how long until the next click, the next failure, the next radioactive decay. It's the simplest continuous, memoryless distribution there is, and Ptd Exponential builds it as a PyTorch Distribution object. If you need positive continuous samples with a long right tail, or you're modeling anything with a "rate" - arrivals, failures, decay - this is the node.

    How it works

    One parameter, rate (usually written λ), parses via ast.literal_eval, and the node constructs torch.distributions.Exponential. The output is a PTDISTRIBUTION, not a sample - from there you use Ptdm Sample to draw values, Ptdm LogProb / Pdf to score them, Ptdm Cdf for cumulative probabilities.

    The shape intuition: the rate is the average number of events per unit time, and the distribution's mean is 1/rate. Higher rate → shorter average wait → samples cluster near zero. Lower rate → longer waits, longer tail. It only ever produces non-negative values, which makes it handy when you want bounded-below, heavily skewed noise or delays in a workflow.

    Unlike several of its siblings (Bernoulli, Beta, Binomial, Chi2), this one is a straight stock PyTorch distribution - no scipy subclass, because the methods the pack needs are already there. So this node doesn't lean on scipy the way its cousins do, even though scipy still ships with the pack.

    The one input that matters

    • rate - the rate parameter, a positive scalar like 0.5, or a tuple like (0.5, 1.0) for a batched distribution.

    It defaults to "", and an empty string blows up at ast.literal_eval - the classic first-run error here is just leaving it blank. Type a number and you're in business.

    Where people get burned

    • Rate must be positive - rate ≤ 0 is undefined for the exponential; keep it > 0.
    • Literal syntax: 0.5 and (0.5, 1.0) parse; 0.5, 1.0 bare doesn't.
    • Remembering the mean is 1/rate, not rate - if your samples look "too small", that's the math working as designed.

    Installing it

    It's in ComfyUI-Pt-Wrapper:

    • ComfyUI Manager → search "ComfyUI-Pt-Wrapper" → Install → restart.
    • Or cd ComfyUI/custom_nodes && git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper and restart.

    Heavy install - requirements include transformers, datasets, peft, accelerate, scikit-learn, scipy, gensim and sentencepiece, so first boot is slow. No model downloads needed. It's a niche educational pack by HowToSD with little community presence; the repo's docs/reference/ is the authoritative doc, and the README invites issues (PRs get auto-closed).

    CategoryDistribution

    Inputs (1)

    NameTypeDefaultDescription
    rateSTRING

    Outputs (1)

    NameTypeDescription
    PTDISTRIBUTIONPTDISTRIBUTION