All problems
SDS Loss Gradient
Problem
Compute one score-distillation-sampling gradient: w(t) * (eps_hat - eps) with weight w(t) = 1 - alpha_bar_t, where eps_hat is the frozen diffusion model's predicted noise.
The signature is sds_loss_gradient(eps_hat, eps, alpha_bar_t). Return the gradient vector.
Hint
SDS turns a pretrained diffusion model into a differentiable renderer for 3D generation.
Test cases
case 1
in: [[1,2],[0,0],0.5]
expected: [0.5,1]
case 2
in: [[0],[0],0]
expected: [0]
case 3
in: [[2,1],[1,2],0.25]
expected: [0.75,-0.75]
case 4
in: [[-1],[1],0.75]
expected: [-0.5]
Starter codePython
def sds_loss_gradient(eps_hat, eps, alpha_bar_t):
# Your code here
pass4 test cases · run your code against them in the editor