File size: 870 Bytes
9aeb839
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""The MOSS Turbo loop is deliberately separate from ComfyUI's Euler sampler."""


def moss_turbo_sample(noise, mixing, codes, predict, tensor_ops, callback=None):
    if tuple(mixing.shape) != (128, 128) or len(codes) != 8:
        raise ValueError("MOSS Turboには128×128のQと8個のstep_codesが必要です。")
    if noise.shape[1] != 128:
        raise ValueError("MOSS Turboのlatent channelsは128です。")
    clean = tensor_ops.zeros_like(noise)
    for index in range(8):
        mixed = noise + tensor_ops.einsum("oc,bchw->bohw", mixing, clean)
        # Identical initial noise at every step, no Euler dt and no CFG branch.
        velocity = predict(mixed, codes[index])
        clean = noise - velocity.float() if hasattr(velocity, "float") else noise - velocity
        if callback is not None:
            callback(index + 1, 8)
    return clean