interplane.Get Omega
Read in your language

MojoLlama

Archived Mojo/MAX quantizer and serving research repository (read-only history)

Brought by drakestapleton

branch main Branches Tags History

MojoLlama / test_metadata.py

31 lines · 1104 bytes Raw Blame History
1#!/usr/bin/env python3
2"""Test _read_gguf_metadata on available GGUF models."""
3import sys
4sys.path.insert(0, '/onedev-workspace/work/src')
5from mojollama.quantizer import _read_gguf_metadata
6import os
7
8models_dir = '/onedev-workspace/work'
9found = 0
10for f in sorted(os.listdir(models_dir)):
11 if f.endswith('.gguf'):
12 path = os.path.join(models_dir, f)
13 try:
14 meta = _read_gguf_metadata(path)
15 arch = meta.get('architecture', '?')
16 params = meta.get('n_params_hr', '?')
17 ctx = meta.get('context_length', '?')
18 blk = meta.get('block_count', '?')
19 quant = meta.get('quant_type', '?')
20 prefixes_used = meta.get('_prefixes_used', [])
21 print(f' {f}:')
22 print(f' arch={arch}, params={params}, ctx={ctx}, layers={blk}, quant={quant}')
23 print(f' prefixes={prefixes_used}')
24 found += 1
25 except Exception as e:
26 print(f' {f}: ERROR - {e}')
27
28if found == 0:
29 print(' No .gguf models found')
30else:
31 print(f'\n Read {found} models successfully')