File size: 669 Bytes
82ea528
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

def is_integer(string):
    try:
        int(string)
        return True
    except ValueError:
        return False
    

class LTXAttnOverrideNode:
    @classmethod
    def INPUT_TYPES(s):
        return {
            "required": {
                "layers": ("STRING", { "multiline": True }),
            }
        }

    RETURN_TYPES = ("ATTN_OVERRIDE",)
    FUNCTION = "build"

    CATEGORY = "ltxtricks/attn"

    def build(self, layers):
        layers_map = set([])
        for block in layers.split(','):
            block = block.strip()
            if is_integer(block):
                layers_map.add(block)

        return ({ "layers": layers_map },)