File size: 589 Bytes
3a186a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import safetensors.torch
import os

# Function to inspect data types in a safetensors file
def inspect_safetensors_dtype(file_path):
    print(f"Inspecting: {file_path}")
    tensors = safetensors.torch.load_file(file_path)
    for key, tensor in tensors.items():
        print(f"Key: {key}, Data Type: {tensor.dtype}")
    print("\n")

# Get all safetensors files in the current directory
safetensors_files = [f for f in os.listdir() if f.endswith('.safetensors')]

# Inspect each safetensors file
for safetensors_file in safetensors_files:
    inspect_safetensors_dtype(safetensors_file)