Download method-v2/validate.py from Noddybear/encoding-tax-e6-exploratory-pilot: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/datasets/Noddybear/encoding-tax-e6-exploratory-pilot/resolve/main/method-v2/validate.py
- Command line
-
hf download hf://datasets/Noddybear/encoding-tax-e6-exploratory-pilot/method-v2/validate.py
-
curl -L -o validate.py https://huggingface.co/datasets/Noddybear/encoding-tax-e6-exploratory-pilot/resolve/main/method-v2/validate.py
1.5 kB
| """Offline native-token and prompt checks before freezing the pilot.""" | |
| import json | |
| from encoding_tax.common import ROOT,load_config,write_json,digest,now,READERS | |
| from encoding_tax.data import load_rows | |
| from encoding_tax.tokenization import tokenizer | |
| from encoding_tax.prompts import serialize,continue_answer | |
| from .design import HERE,cases,truth,body,case_id | |
| def main(): | |
| cfg=load_config(str(HERE/'config.json'));base=load_config() | |
| rows=load_rows({'datasets':{'synthetic':cfg['dataset']}},'synthetic','pilot') | |
| results={} | |
| for reader in READERS: | |
| p=base['models'][reader];tok=tokenizer(p['tokenizer_repo'],p['tokenizer_revision']) | |
| maxanswer=0;maxprompt=0 | |
| for m in cases(rows,reader): | |
| text,_=body(m,base);raw=serialize(p,text,'scratchpad');count=tok.count(raw) | |
| maxprompt=max(maxprompt,count) | |
| assert count+m['budget']+48+64<p['context_length'],case_id(m) | |
| if m['mode']=='diagnostic': | |
| n=tok.count(json.dumps(truth(m),separators=(',',':')));maxanswer=max(maxanswer,n) | |
| assert n<=48,case_id(m) | |
| results[reader]={'samples':1824,'maximum_initial_prompt_tokens':maxprompt,'maximum_canonical_diagnostic_tokens':maxanswer,'answer_cap':48,'context_verified':True} | |
| print(reader,results[reader],flush=True) | |
| write_json(HERE/'validation.json',{'recorded_at':now(),'offline_only':True,'config_sha256':digest(HERE/'config.json'),'readers':results}) | |
| if __name__=='__main__':main() | |