Testk / key.py
MoeZilla's picture
Update key.py
b9c39cc verified
raw
history blame contribute delete
438 Bytes
from safetensors.torch import load_file
# Load the safetensors file
filename = "flowgram.safetensors"
tensor_dict = load_file(filename)
# Open a log file to write the keys and dtype
with open('log.txt', 'w') as log_file:
for key, tensor in tensor_dict.items():
# Write the key and the dtype of the tensor
log_file.write(f"Key: {key}, Dtype: {tensor.dtype}\n")
print("Log file has been updated with keys and dtype.")