Sync the repo with the working directory: full NOTES.md (rounds 4-5, LFM3-VL), VL tests and test images, quality eval, AutoRound W4A16 quantization scripts and calibration recipe, the variant.sh MODEL/DOCKER_ENV options, and the remaining benchmark results. Large regenerable artifacts (INT4 checkpoint, ref_vl.pt, raw logprob dumps) stay out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
1.1 KiB
Python
18 lines
1.1 KiB
Python
# Fixed eval inputs: wikitext-2-raw-v1 test -> 20 contiguous 2048-token chunks (LFM3 tokenizer), plus
|
|
# a ~2k-token article for summarization and ~700 tokens of filler for the long-context prompt.
|
|
import json, sys
|
|
from datasets import load_dataset
|
|
from transformers import AutoTokenizer
|
|
tok = AutoTokenizer.from_pretrained(sys.argv[1])
|
|
text = "".join(load_dataset("Salesforce/wikitext", "wikitext-2-raw-v1", split="test")["text"])
|
|
ids = tok(text, add_special_tokens=False)["input_ids"]
|
|
chunks = [ids[i:i + 2048] for i in range(0, 20 * 2048, 2048)]
|
|
import re
|
|
heads = [m.start() for m in re.finditer(r"^ = [^=\n]+ = $", text, re.M)] # top-level article titles
|
|
arts = [text[a:b].strip() for a, b in zip(heads, heads[1:] + [len(text)])]
|
|
long_art = next(a for a in arts if 1700 <= len(tok(a)["input_ids"]) <= 2400)
|
|
filler = tok.decode(ids[60000:60700])
|
|
json.dump({"ppl_chunks": chunks, "summary_article": long_art, "filler_700": filler},
|
|
open(sys.argv[2], "w"), ensure_ascii=False)
|
|
print(len(chunks), "ppl chunks;", len(tok(long_art)["input_ids"]), "tok article;", len(tok(filler)["input_ids"]), "tok filler")
|