With a single command, quantize the same model across every available quant scheme and configuration and output a table that compares the results. This will allow users to make better decisions about what quant scheme to use
Extend the eval command to quant and allow users to compare the performance and correctness of different quantization schemes.
Command would be something like this
torchchat.py eval llama3.1 --quantize linear dynamic --device mps --outputFormat table
In this instance the command would evaluate each available option dtype or configuration for each scheme specified.
New flags for eval
--quantize (optional and default to none)
Description: provide a set of quantization schemes to use and the command will try to run quantization on every permutation based on the dtypes available. single scheme sample: {linear}, multi-scheme sample: {linear, dynamic, embedding}. If embedding is specified, there will be an m*n of every quant + embedding available.
All available options: linear, dynamic, embedding, embedding:wx
--outputFormat (optional and default to table)
Description: the format of the output. Either table or json
Design
All available options for a particular scheme, model, device and execution mode stored in a json object.
This will be the source of truth and the command can iterate through
dictionary to run eval on every possible permutation
This will be stored in quant_config/quant.json
Format of the object should be something like:
The model definitions in mode_config/models.json will be extended to include a new property model_type
The eval.py needs to be extended so that evaluation can be run multiple times and generate the list of runs to make based on the flag values that came in.
When the model comes in we can look up the model type and device and then run all the configs in the set that match the schemes present in the --quantize flag
If --quantization is not present we do a single run using the specified params
🚀 The feature, motivation and pitch
With a single command, quantize the same model across every available quant scheme and configuration and output a table that compares the results. This will allow users to make better decisions about what quant scheme to use
Extend the eval command to quant and allow users to compare the performance and correctness of different quantization schemes.
Command would be something like this
In this instance the command would evaluate each available option dtype or configuration for each scheme specified.
And outputs a table that compares them all
Model: Llama 3.1 Instruct 8B Device: M1 Max 64GB MPS ExecutionMode: Eager
New flags for eval
--quantize (optional and default to none)
Description: provide a set of quantization schemes to use and the command will try to run quantization on every permutation based on the dtypes available. single scheme sample:{linear}
, multi-scheme sample:{linear, dynamic, embedding}
. If embedding is specified, there will be an m*n of every quant + embedding available. All available options:linear, dynamic, embedding, embedding:wx
--outputFormat (optional and default to table)
Description: the format of the output. Eithertable
orjson
Design
All available options for a particular scheme, model, device and execution mode stored in a json object. This will be the source of truth and the command can iterate through dictionary to run eval on every possible permutation This will be stored in quant_config/quant.json Format of the object should be something like:
modeltype options:
textOnly
,llamaTextOnly
,llamaVision
,llava
The model definitions in mode_config/models.json will be extended to include a new property
model_type
The eval.py needs to be extended so that evaluation can be run multiple times and generate the list of runs to make based on the flag values that came in.
When the model comes in we can look up the model type and device and then run all the configs in the set that match the schemes present in the
--quantize
flag If--quantization
is not present we do a single run using the specified params