Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save joemaddalone/f07cf8a575e78ba9a61def91b3ae1bd8 to your computer and use it in GitHub Desktop.

Select an option

Save joemaddalone/f07cf8a575e78ba9a61def91b3ae1bd8 to your computer and use it in GitHub Desktop.
import struct
import main
with open(main.pathToModel, 'rb') as f:
magic = f.read(4).decode('utf-8')
version = struct.unpack('<I', f.read(4))[0]
tensor_count = struct.unpack('<Q', f.read(8))[0]
kv_count = struct.unpack('<Q', f.read(8))[0]
print(f'Magic: {magic}')
print(f'Version: {version}')
print(f'Tensors: {tensor_count}')
print(f'Metadata pairs: {kv_count}')%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment