MojoLlama
Archived Mojo/MAX quantizer and serving research repository (read-only history)
Brought by drakestapleton
MojoLlama / test_metadata.py
| 1 | #!/usr/bin/env python3 |
| 2 | """Test _read_gguf_metadata on available GGUF models.""" |
| 3 | import sys |
| 4 | sys.path.insert(0, '/onedev-workspace/work/src') |
| 5 | from mojollama.quantizer import _read_gguf_metadata |
| 6 | import os |
| 7 | |
| 8 | models_dir = '/onedev-workspace/work' |
| 9 | found = 0 |
| 10 | for 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 | |
| 28 | if found == 0: |
| 29 | print(' No .gguf models found') |
| 30 | else: |
| 31 | print(f'\n Read {found} models successfully') |