| 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) |