pranavajay commited on
Commit
48d31ab
·
verified ·
1 Parent(s): 16f1e64

Rename fix.py to sh.py

Browse files
Files changed (2) hide show
  1. fix.py +0 -13
  2. sh.py +19 -0
fix.py DELETED
@@ -1,13 +0,0 @@
1
- from safetensors.torch import load_file
2
-
3
- # Step 1: Load the safetensors file
4
- checkpoint_path = 'flowgram.safetensors' # Replace with your actual file path
5
- checkpoint = load_file(checkpoint_path)
6
-
7
- # Step 2: Open a log file to save the output
8
- with open("log.txt", "w") as log_file:
9
- # Step 3: Write the size (shape) of each tensor to the file
10
- for tensor_name, tensor in checkpoint.items():
11
- log_file.write(f"Tensor Name: {tensor_name}, Size: {tensor.shape}\n")
12
-
13
- print("Tensor sizes saved to log.txt")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
sh.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import safetensors
2
+
3
+ # Load both models
4
+ model1 = safetensors.load_file('merged_model0.safetensors')
5
+ model2 = safetensors.load_file('diffusion_pytorch_model-00001-of-00003.safetensors')
6
+
7
+ # Iterate through the tensor names and shapes
8
+ for name in model1.keys():
9
+ if name in model2:
10
+ shape1 = model1[name].shape
11
+ shape2 = model2[name].shape
12
+ if shape1 != shape2:
13
+ print(f"Tensor '{name}' has different shapes: Model 1: {shape1}, Model 2: {shape2}")
14
+ else:
15
+ print(f"Tensor '{name}' is not present in model 2.")
16
+
17
+ for name in model2.keys():
18
+ if name not in model1:
19
+ print(f"Tensor '{name}' is not present in model 1.")