All problems
Classifier-Free Guidance Combine
Problem
Combine conditional and unconditional noise predictions for classifier-free guidance: eps = eps_uncond + scale * (eps_cond - eps_uncond).
The signature is cfg_combine(eps_uncond, eps_cond, scale).
Hint
Scale 1 recovers the conditional model; larger scales sharpen prompt adherence.
Test cases
case 1
in: [[0,0],[1,2],3]
expected: [3,6]
case 2
in: [[1,1],[1,1],5]
expected: [1,1]
case 3
in: [[0.5,-0.5],[1,0.5],2]
expected: [1.5,1.5]
case 4
in: [[0],[1],0]
expected: [0]
Starter codePython
def cfg_combine(eps_uncond, eps_cond, scale):
# Your code here
pass4 test cases · run your code against them in the editor