import torch from safetensors.torch import load_file # Load both models model1 = load_file('merged_model_016.safetensors') model2 = load_file('diffusion_pytorch_model-00001-of-00003.safetensors') # Iterate through the tensor names and shapes for name in model1.keys(): if name in model2: shape1 = model1[name].shape shape2 = model2[name].shape if shape1 != shape2: print(f"Tensor '{name}' has different shapes: Model 1: {shape1}, Model 2: {shape2}") else: print(f"Tensor '{name}' is not present in model 2.") for name in model2.keys(): if name not in model1: print(f"Tensor '{name}' is not present in model 1.")