INNER CODE UNIT · Python

__init__

Extraltodeus/ComfyUI-AutomaticCFG · experimental_temperature.py:17

    def __init__(self, temperature, layer_name="None"):
        self.temperature = temperature
        self.layer_name  = layer_name
    
    # taken from comfy.ldm.modules
    def attention_basic_with_temperature(self, q, k, v, extra_options, mask=None, attn_precision=None):
        if isinstance(extra_options, int):
            heads = extra_options
        else:
            heads = extra_options['n_heads']

        b, _, dim_head = q.shape
        dim_head //= heads
        scale = dim_head ** -0.5

        h = heads
        q, k, v = map(
            lambda t: t.unsqueeze(3)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…