#!/usr/bin/env python3 """ Norovox toplu paket scripti — tüm modelleri tek ZIP'te toplar. Kullanım: python pack_norovox.py --filter n1 # sadece N-1 python pack_norovox.py --filter nythos --open # sansürsüz Nythos python pack_norovox.py --output norovox_all.zip # hepsi python pack_norovox.py --list # sadece liste """ import os, sys, argparse, zipfile, json from pathlib import Path from huggingface_hub import hf_hub_download, HfApi USER = "emrevrg" TOKEN = os.environ.get("HF_TOKEN", "") MODELS = [ # (key, repo, file) ("n1-0.5b", "Norovox-N1-0.5B-GGUF", "Norovox-N1-0.5B-Q4_K_M.gguf"), ("n1-0.5b-open", "Norovox-N1-0.5B-Open-GGUF", "Norovox-N1-0.5B-Q4_K_M.gguf"), ("n1-1.5b", "Norovox-N1-1.5B-GGUF", "Norovox-N1-1.5B-Q4_K_M.gguf"), ("n1-1.5b-open", "Norovox-N1-1.5B-Open-GGUF", "Norovox-N1-1.5B-Q4_K_M.gguf"), ("n1-3b", "Norovox-N1-3B-GGUF", "Norovox-N1-3B-Q4_K_M.gguf"), ("n1-3b-open", "Norovox-N1-3B-Open-GGUF", "Norovox-N1-3B-Q4_K_M.gguf"), ("n1-7b", "Norovox-N1-7B-GGUF", "Norovox-N1-7B-Q4_K_M.gguf"), ("n1-7b-open", "Norovox-N1-7B-Open-GGUF", "Norovox-N1-7B-Q4_K_M.gguf"), ("nythos-0.8b", "Norovox-Nythos-0.8B-GGUF", "Norovox-Nythos-0.8B-Q4_K_M.gguf"), ("nythos-0.8b-open", "Norovox-Nythos-0.8B-Open-GGUF", "Norovox-Nythos-0.8B-Q4_K_M.gguf"), ("nythos-4b", "Norovox-Nythos-4B-GGUF", "Norovox-Nythos-4B-Q4_K_M.gguf"), ("nythos-4b-open", "Norovox-Nythos-4B-Open-GGUF", "Norovox-Nythos-4B-Q4_K_M.gguf"), ("nythos-9b", "Norovox-Nythos-9B-GGUF", "Norovox-Nythos-9B-Q4_K_M.gguf"), ("nythos-9b-open", "Norovox-Nythos-9B-Open-GGUF", "Norovox-Nythos-9B-Q4_K_M.gguf"), ("nythos-27b", "Norovox-Nythos-27B-GGUF", "Norovox-Nythos-27B-Q4_K_M.gguf"), ("nythos-27b-open", "Norovox-Nythos-27B-Open-GGUF", "Norovox-Nythos-27B-Q4_K_M.gguf"), ("nythos-35b", "Norovox-Nythos-35B-A3B-GGUF", "Norovox-Nythos-35B-A3B-Q4_K_M.gguf"), ] def main(): p = argparse.ArgumentParser() p.add_argument("--filter", choices=["n1", "nythos", "all"], default="all") p.add_argument("--open", action="store_true", help="Sadece open varyant") p.add_argument("--public", action="store_true", help="Sadece public varyant") p.add_argument("--output", "-o", default="norovox.zip") p.add_argument("--list", action="store_true") p.add_argument("--token", default=TOKEN, help="HF token") args = p.parse_args() if args.list: for key, _, _ in MODELS: print(f" {key}") return if not args.token: print("HATA: HF_TOKEN env var veya --token bayrağı gerek") sys.exit(1) # Filtrele selected = [] for key, repo, file in MODELS: if args.filter != "all" and args.filter not in key: continue is_open = key.endswith("-open") if args.open and not is_open: continue if args.public and is_open: continue selected.append((key, repo, file)) print(f"\n {len(selected)} model paketlenecek -> {args.output}\n") tmp = Path("./.norovox_tmp") tmp.mkdir(exist_ok=True) with zipfile.ZipFile(args.output, "w", zipfile.ZIP_STORED) as zf: for i, (key, repo, file) in enumerate(selected, 1): print(f" [{i}/{len(selected)}] {key}...") try: local = hf_hub_download( repo_id=f"{USER}/{repo}", filename=file, local_dir=str(tmp), token=args.token, ) # Zip'e ekle (ZIP_STORED — GGUF zaten quantized, sıkıştırma yok) zf.write(local, arcname=f"{key}/{file}") # README de ekle try: readme = hf_hub_download( repo_id=f"{USER}/{repo}", filename="README.md", local_dir=str(tmp), token=args.token, ) zf.write(readme, arcname=f"{key}/README.md") os.remove(readme) except: pass os.remove(local) print(f" [OK] eklendi") except Exception as e: print(f" [FAIL] {type(e).__name__}: {str(e)[:120]}") # Manifest manifest = { "norovox_version": "1.0", "models": [key for key, _, _ in selected], "total": len(selected), } with zipfile.ZipFile(args.output, "a") as zf: zf.writestr("manifest.json", json.dumps(manifest, indent=2, ensure_ascii=False)) size_gb = os.path.getsize(args.output) / 1e9 print(f"\n [DONE] {args.output} -> {size_gb:.1f} GB") if __name__ == "__main__": main()