Views
No views yet
util/measure.py that will compare two exllamav3 models module by module against the original model. The goal is to see which modules are the most affected by the decrease in precision involved in going from a larger quant to a smaller quant.python util/measure.py -l [level] -d [device] -ms [max_sys_memory] -i [path/to/quant1] [path/to/quant2] -r [path/to/original_model] -o [path/to/measurement.json]level is an integer between 0 and 3 that determines the resolution of the measurement. 0 is fastest but least granular, 2 is default, 3 is most granular and slowest.device is the index of the CUDA device that will perform the workmax_sys_memory is the amount of memory that can be used for state data to speed things up, in GiBpath/to/quant1 and path/to/quant2 are the paths to the two quants to comparepath/to/original_model is the path to the original modelpath/to/measurement.json is the path to the resulting json measurement fileutil/optimize.py to create optimized quants that draw modules from both quants where appropriate to get the best result for a given bitrate.python util/optimize.py -i [path/to/quant1] [path/to/quant2] -o [path/to/resulting_model] -m [path/to/measurement.json] -b [target_bitrate]path/to/quant1 and path/to/quant2 are paths to the two source modelspath/to/resulting_model is the output pathtarget_bitrate is the target bitrate as a number a decimal point

eval/spec/wiki2_llama3_large.json.1{
2 "tokenize_fn": "transformers",
3 "tokenizer_dir": "path/to/full_model",
4 "dataset": "wiki2",
5 "eval_stride": 512,
6 "eval_len": 2048,
7 "max_rows": 100
8}eval/compare_q_logits.py as follows:python eval/compare_q_logits.py -m [path/to/full_model] -o [path/to/output_logits.safetensors] -d [path/to/dataset_spec.json] -rpb [rows_per_batch] -dev [device_index]path/to/full_model is the path to the modelpath/to/output_logits.safetensors is the path to the output logits filepath/to/dataset_spec.json is the path to the dataset spec file described aboverows_per_batch - I would run out of memory without this parameter. I set it to 32768.device_index - optional CUDA device index1[
2 {
3 "load_fn": "exllamav3",
4 "fwd_fn": "exllamav3",
5 "label": "EXL3 2.0bpw H6",
6 "model_dir": "path/to/zai-org_GLM-4.6-2.0bpw-h6-exl3"
7 },
8 {
9 "load_fn": "exllamav3",
10 "fwd_fn": "exllamav3",
11 "label": "EXL3 2.25bpw H6 optimize.py",
12 "model_dir": "path/to/zai-org_GLM-4.6-2.25bpw-h6-exl3"
13 }
14]python eval/compare_q.py -d [path/to/dataset_spec.json] -m [path/to/model_spec.json] -lf [path/to/logits.safetensors] -p [-kld] -t [chart_title]path/to/dataset_spec.json is the path to the dataset spec file described abovepath/to/model_spec.json is the path to the model spec file described abovepath/to/logits.safetensors is the path to the full model's logits, created above-kld the script creates a perplexity chart by default, add this if you want K/L-d insteadchart_title the chart title in the resulting plotplt.show(). I hacked in an extra arg and a plt.savefig() install instead.