Commit f90798c6 authored by ULTRANOX\Chris's avatar ULTRANOX\Chris
Browse files

Added error check for the rare case a user merges a pix2pix model with a...

Added error check for the rare case a user merges a pix2pix model with a normal model using weighted sum.  Also removed bad print message that interfered with merging progress bar.
parent f4ec411f
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -186,9 +186,10 @@ def run_modelmerger(id_task, primary_model_name, secondary_model_name, tertiary_
            if a.shape != b.shape and a.shape[0:1] + a.shape[2:] == b.shape[0:1] + b.shape[2:]:
            if a.shape != b.shape and a.shape[0:1] + a.shape[2:] == b.shape[0:1] + b.shape[2:]:
                if a.shape[1] == 4 and b.shape[1] == 9:
                if a.shape[1] == 4 and b.shape[1] == 9:
                    raise RuntimeError("When merging inpainting model with a normal one, A must be the inpainting model.")
                    raise RuntimeError("When merging inpainting model with a normal one, A must be the inpainting model.")
                if a.shape[1] == 4 and b.shape[1] == 8:
                    raise RuntimeError("When merging pix2pix model with a normal one, A must be the pix2pix model.")


                if a.shape[1] == 8 and b.shape[1] == 4:#If we have an InstructPix2Pix model...
                if a.shape[1] == 8 and b.shape[1] == 4:#If we have an InstructPix2Pix model...
                    print("Detected possible merge of instruct model with non-instruct 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.
                    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.
                    result_is_pix2pix_model = True
                    result_is_pix2pix_model = True
                else:
                else: