char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
c95f8e47b
char/aliceai-t5-moe
1name : Code Style Checker 2 3on : 4workflow_dispatch : # allows manual triggering 5push : 6branches : 7- master 8pull_request : 9branches : 10- master 11 12concurrency : 13group : ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} 14cancel-in-progress : true 15 16jobs : 17model-naming : 18runs-on : ubuntu-slim 19steps : 20- uses : actions/checkout@v6 21- name : Check model naming conventions 22run : | 23 python3 - << 'EOF' 24 import re, os, sys 25 26 pairs = re.findall( 27 r'case\s+(LLM_ARCH_\w+)\s*:\s*\n\s+return new (llama_model_\w+)\s*\(', 28 open("src/llama-model.cpp").read()) 29 30 errors = [] 31 for arch, cls in pairs: 32 suffix = arch[len("LLM_ARCH_"):] 33 csuffix = cls[len("llama_model_"):] 34 fname = csuffix.replace("_", "-") + ".cpp" 35 36 if not re.fullmatch(r'[A-Z][A-Z0-9_]*', suffix): 37 errors.append(f"{arch}: suffix not upper snake case, example: LLM_ARCH_MY_MODEL") 38 39 if not re.fullmatch(r'[a-z][a-z0-9_]*', csuffix): 40 errors.append(f"{arch}: class suffix not lower snake case, example: llama_model_my_model") 41 42 elif suffix.lower() != csuffix: 43 errors.append(f"{arch}: arch/class name mismatch, expected class 'llama_model_{suffix.lower()}' but got '{cls}'") 44 45 elif not os.path.isfile(f"src/models/{fname}"): 46 errors.append(f"{arch}: expects model file name to be src/models/{fname}, but not found") 47 48 if errors: 49 print('\n'.join(f" - {e}" for e in errors)); sys.exit(1) 50 print(f"OK: {len(pairs)} mappings validated.") 51 EOF