| 11 | } while (0) |
| 12 | |
| 13 | int main() { |
| 14 | fprintf(stderr, "=== test-gguf-model-data ===\n"); |
| 15 | |
| 16 | // Fetch Qwen3-0.6B Q8_0 metadata |
| 17 | auto result = gguf_fetch_model_meta("ggml-org/Qwen3-0.6B-GGUF", "Q8_0"); |
| 18 | |
| 19 | if (!result.has_value()) { |
| 20 | fprintf(stderr, "SKIP: could not fetch model metadata (no network or HTTP disabled)\n"); |
| 21 | return 0; |
| 22 | } |
| 23 | |
| 24 | const auto & model = result.value(); |
| 25 | |
| 26 | fprintf(stderr, "Architecture: %s\n", model.architecture.c_str()); |
| 27 | fprintf(stderr, "n_embd: %u\n", model.n_embd); |
| 28 | fprintf(stderr, "n_ff: %u\n", model.n_ff); |
| 29 | fprintf(stderr, "n_vocab: %u\n", model.n_vocab); |
| 30 | fprintf(stderr, "n_layer: %u\n", model.n_layer); |
| 31 | fprintf(stderr, "n_head: %u\n", model.n_head); |
| 32 | fprintf(stderr, "n_head_kv: %u\n", model.n_head_kv); |
| 33 | fprintf(stderr, "n_expert: %u\n", model.n_expert); |
| 34 | fprintf(stderr, "n_embd_head_k: %u\n", model.n_embd_head_k); |
| 35 | fprintf(stderr, "n_embd_head_v: %u\n", model.n_embd_head_v); |
| 36 | fprintf(stderr, "tensors: %zu\n", model.tensors.size()); |
| 37 | |
| 38 | // Verify architecture |
| 39 | TEST_ASSERT(model.architecture == "qwen3", "expected architecture 'qwen3'"); |
| 40 | |
| 41 | // Verify key dimensions (Qwen3-0.6B) |
| 42 | TEST_ASSERT(model.n_layer == 28, "expected n_layer == 28"); |
| 43 | TEST_ASSERT(model.n_embd == 1024, "expected n_embd == 1024"); |
| 44 | TEST_ASSERT(model.n_head == 16, "expected n_head == 16"); |
| 45 | TEST_ASSERT(model.n_head_kv == 8, "expected n_head_kv == 8"); |
| 46 | TEST_ASSERT(model.n_expert == 0, "expected n_expert == 0 (not MoE)"); |
| 47 | TEST_ASSERT(model.n_vocab == 151936, "expected n_vocab == 151936"); |
| 48 | |
| 49 | // Verify tensor count |
| 50 | TEST_ASSERT(model.tensors.size() == 311, "expected tensor count == 311"); |
| 51 | |
| 52 | // Verify known tensor names exist |
| 53 | bool found_attn_q = false; |
| 54 | bool found_token_embd = false; |
| 55 | bool found_output_norm = false; |
| 56 | for (const auto & t : model.tensors) { |
| 57 | if (t.name == "blk.0.attn_q.weight") { |
| 58 | found_attn_q = true; |
| 59 | } |
| 60 | if (t.name == "token_embd.weight") { |
| 61 | found_token_embd = true; |
| 62 | } |
| 63 | if (t.name == "output_norm.weight") { |
| 64 | found_output_norm = true; |
| 65 | } |
| 66 | } |
| 67 | TEST_ASSERT(found_attn_q, "expected tensor 'blk.0.attn_q.weight'"); |
| 68 | TEST_ASSERT(found_token_embd, "expected tensor 'token_embd.weight'"); |
| 69 | TEST_ASSERT(found_output_norm, "expected tensor 'output_norm.weight'"); |
| 70 |
nothing calls this directly
no test coverage detected