raiseRuntimeError("When merging inpainting model with a normal one, A must be the inpainting model.")
raiseRuntimeError("When merging inpainting model with a normal one, A must be the inpainting model.")
ifa.shape[1]==4andb.shape[1]==8:
raiseRuntimeError("When merging instruct-pix2pix model with a normal one, A must be the instruct-pix2pix model.")
asserta.shape[1]==9andb.shape[1]==4,f"Bad dimensions for merged layer {key}: A={a.shape}, B={b.shape}"
ifa.shape[1]==8andb.shape[1]==4:#If we have an Instruct-Pix2Pix model...
theta_0[key][:,0:4,:,:]=theta_func2(a[:,0:4,:,:],b,multiplier)#Merge only the vectors the models have in common. Otherwise we get an error due to dimension mismatch.