mirror of
https://github.com/TheTom/turboquant_plus.git
synced 2026-10-21 10:40:06 -05:00
Promote refract to top-level package (refract/, not turboquant/refract/)
REFRACT is meant to be a general KV-quant quality oracle, applicable across model families (gemma, qwen, mistral, phi, llama, etc.) and not TurboQuant-specific. Top-level placement reflects that scope and gives a cleaner CLI: `python3 -m refract.cli` instead of nested under turboquant. Updates: - git mv turboquant/refract/ -> refract/ - All `from turboquant.refract` -> `from refract` imports rewritten - pyproject.toml: include both turboquant* and refract* in setuptools - All "turboquant/refract/" path references in README/tests updated Verified: 14/14 unit tests pass, CLI module path works.
This commit is contained in:
1 parent
1197aa067e
commit
2e78787cb0
15 files changed
+22
-22
No files matched your search
+1
-1
@@ -18,7 +18,7 @@ bench = [
|
||||
]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["turboquant*"]
|
||||
include = ["turboquant*", "refract*"]
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools>=68"]
|
||||
|
||||
@@ -55,11 +55,11 @@ export LLAMA_CPP_BIN_DIR=/path/to/llama.cpp/build/bin
|
||||
## Quickstart
|
||||
|
||||
```bash
|
||||
python3 -m turboquant.refract.cli score \
|
||||
python3 -m refract.cli score \
|
||||
--model ~/local_llms/models/Qwen2.5-7B-Instruct-Q8_0.gguf \
|
||||
--reference 'ctk=f16,ctv=f16' \
|
||||
--candidate 'ctk=q8_0,ctv=turbo4,attn_rot_v=0' \
|
||||
--prompts turboquant/refract/prompts/v0.1.jsonl \
|
||||
--prompts refract/prompts/v0.1.jsonl \
|
||||
--corpus ~/local_llms/llama.cpp/wikitext-2-raw/wiki.test.raw \
|
||||
--chunks 32 -c 512 -ngl 99 \
|
||||
--measure-floor \
|
||||
@@ -143,17 +143,17 @@ It is marked `integration` because it spawns llama.cpp many times against a
|
||||
```bash
|
||||
# Mark it in pytest.ini if not already:
|
||||
# markers = integration: marks tests requiring llama.cpp + a real GGUF
|
||||
pytest -m integration turboquant/refract/tests/test_validation.py -s
|
||||
pytest -m integration refract/tests/test_validation.py -s
|
||||
```
|
||||
|
||||
Or directly via CLI:
|
||||
|
||||
```bash
|
||||
python3 -m turboquant.refract.cli score \
|
||||
python3 -m refract.cli score \
|
||||
--model ~/local_llms/models/gemma-4-26B-A4B-Q8_0.gguf \
|
||||
--reference 'ctk=f16,ctv=f16' \
|
||||
--candidate 'ctk=q8_0,ctv=turbo4,attn_rot_v=0,attn_rot_k=0' \
|
||||
--prompts turboquant/refract/prompts/v0.1.jsonl \
|
||||
--prompts refract/prompts/v0.1.jsonl \
|
||||
--corpus ~/local_llms/llama.cpp/wikitext-2-raw/wiki.test.raw \
|
||||
--chunks 32 --measure-floor
|
||||
```
|
||||
@@ -163,7 +163,7 @@ Fast unit tests (no subprocess) live in `tests/test_unit.py`.
|
||||
## File layout
|
||||
|
||||
```
|
||||
turboquant/refract/
|
||||
refract/
|
||||
__init__.py
|
||||
cli.py # CLI entry point
|
||||
score.py # composite + bands + floor logic
|
||||
@@ -9,7 +9,7 @@ quantization quality. Replaces "lower PPL = better" with a composite of:
|
||||
(v0.1 uses corpus KLD via llama-perplexity as a proxy for trajectory KLD).
|
||||
|
||||
See:
|
||||
- turboquant/refract/README.md for usage.
|
||||
- refract/README.md for usage.
|
||||
- docs/papers/attn-rotation-and-ppl-artifact.md for the motivating paper.
|
||||
"""
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,11 +1,11 @@
|
||||
"""REFRACT v0.1 CLI.
|
||||
|
||||
Usage:
|
||||
python3 -m turboquant.refract.cli score \\
|
||||
python3 -m refract.cli score \\
|
||||
--model MODEL.gguf \\
|
||||
--reference "ctk=f16,ctv=f16" \\
|
||||
--candidate "ctk=q8_0,ctv=turbo4,attn_rot_v=0" \\
|
||||
--prompts turboquant/refract/prompts/v0.1.jsonl \\
|
||||
--prompts refract/prompts/v0.1.jsonl \\
|
||||
--corpus ~/local_llms/llama.cpp/wikitext-2-raw/wiki.test.raw \\
|
||||
--chunks 32 -c 512 -ngl 99
|
||||
"""
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
|
||||
"""Fast unit tests for REFRACT scoring math + parsers. No subprocess.
|
||||
|
||||
Run with:
|
||||
pytest turboquant/refract/tests/test_unit.py
|
||||
pytest refract/tests/test_unit.py
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -10,10 +10,10 @@ import math
|
||||
|
||||
import pytest
|
||||
|
||||
from turboquant.refract.axes.gtm import _diff, _tokenize_words
|
||||
from turboquant.refract.axes.kld import _kld_to_score
|
||||
from turboquant.refract.runner import KVConfig
|
||||
from turboquant.refract.score import (
|
||||
from refract.axes.gtm import _diff, _tokenize_words
|
||||
from refract.axes.kld import _kld_to_score
|
||||
from refract.runner import KVConfig
|
||||
from refract.score import (
|
||||
MIN_FLOOR,
|
||||
band,
|
||||
composite_score,
|
||||
@@ -20,15 +20,15 @@ must NOT mistake that for a pass.
|
||||
This test is integration-only: it spawns llama-cli + llama-perplexity many
|
||||
times against a 26B-A4B model and takes 30+ minutes. Run with:
|
||||
|
||||
pytest -m integration turboquant/refract/tests/test_validation.py
|
||||
pytest -m integration refract/tests/test_validation.py
|
||||
|
||||
or directly:
|
||||
|
||||
python3 -m turboquant.refract.cli score \\
|
||||
python3 -m refract.cli score \\
|
||||
--model ~/local_llms/models/gemma-4-26B-A4B-Q8_0.gguf \\
|
||||
--reference 'ctk=f16,ctv=f16' \\
|
||||
--candidate 'ctk=q8_0,ctv=turbo4,attn_rot_v=0,attn_rot_k=0' \\
|
||||
--prompts turboquant/refract/prompts/v0.1.jsonl \\
|
||||
--prompts refract/prompts/v0.1.jsonl \\
|
||||
--corpus ~/local_llms/llama.cpp/wikitext-2-raw/wiki.test.raw \\
|
||||
--chunks 32 --measure-floor
|
||||
"""
|
||||
@@ -40,10 +40,10 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from turboquant.refract.axes.gtm import run_gtm
|
||||
from turboquant.refract.axes.kld import run_kld
|
||||
from turboquant.refract.runner import KVConfig
|
||||
from turboquant.refract.score import composite_score
|
||||
from refract.axes.gtm import run_gtm
|
||||
from refract.axes.kld import run_kld
|
||||
from refract.runner import KVConfig
|
||||
from refract.score import composite_score
|
||||
|
||||
|
||||
# Default paths; override via env if your model lives elsewhere.
|
||||
Reference in new issue
Block a user