c4ai-command-r-plus - EXL2 2.75bpw
This is a 2.75bpw EXL2 quant of CohereForAI/c4ai-command-r-plus
Details about the model can be found at the above model page.
Turbodep EXL2 Quants
This repo only has specific quants not already done at turboderp/command-r-plus-103B-exl2
Quants marked as turboderp can be downloaded from that repo.
EXL2 Version
These quants were made with exllamav2 version 0.0.18. Quants made on this version of EXL2 may not work on older versions of the exllamav2 library.
If you have problems loading these models, please update Text Generation WebUI to the latest version.
Perplexity Scoring
Below are the perplexity scores for the EXL2 models. A lower score is better.
Quant Level | Perplexity Score | Repo |
---|---|---|
6.0 | 4.7068 | turboderp |
5.5 | 4.7136 | Dracones |
5.0 | 4.7309 | turboderp |
4.5 | 4.8111 | turboderp |
4.25 | 4.8292 | turboderp |
4.0 | 4.8603 | turboderp |
3.75 | 4.9112 | turboderp |
3.5 | 4.9592 | turboderp |
3.25 | 5.0631 | turboderp |
3.0 | 5.2050 | turboderp |
2.75 | 5.3820 | Dracones |
2.5 | 5.6681 | turboderp |
2.25 | 5.9769 | Dracones |
EQ Bench
Here are the EQ Bench scores for the EXL2 quants using Alpaca, ChatML, Command-R and Command-R-Plus prompt templates. A higher score is better.
Quant Size | Alpaca | ChatML | Command-R | Command-R-Plus |
---|---|---|---|---|
6.0 | 70.77 | 62.58 | 75.81 | 74.95 |
5.5 | 71.93 | 67.7 | 74.9 | 75.48 |
5.0 | 69.51 | 63.94 | 74.92 | 75.28 |
Note: EQ Bench scripting not working well, other quants may not be tested.
Command-R-Plus Template
This is the Command-R-Plus template yaml that was used in EQ bench(which uses Text Generation Web UI yaml templates). It adds BOS_TOKEN into the starter prompt.
text-generation-webui/instruction-templates/Command-R-Plus.yaml:
instruction_template: |-
{%- if messages[0]['role'] == 'system' -%}
{%- set loop_messages = messages[1:] -%}
{%- set system_message = messages[0]['content'] -%}
{%- elif false == true -%}
{%- set loop_messages = messages -%}
{%- set system_message = 'You are Command-R, a brilliant, sophisticated, AI-assistant trained to assist human users by providing thorough responses. You are trained by Cohere.' -%}
{%- else -%}
{%- set loop_messages = messages -%}
{%- set system_message = false -%}
{%- endif -%}
{%- if system_message != false -%}
{{ '<BOS_TOKEN><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>' + system_message + '<|END_OF_TURN_TOKEN|>' }}
{%- endif -%}
{%- for message in loop_messages -%}
{%- set content = message['content'] -%}
{%- if message['role'] == 'user' -%}
{{ '<|START_OF_TURN_TOKEN|><|USER_TOKEN|>' + content.strip() + '<|END_OF_TURN_TOKEN|>' }}
{%- elif message['role'] == 'assistant' -%}
{{ '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' + content.strip() + '<|END_OF_TURN_TOKEN|>' }}
{%- endif -%}
{%- endfor -%}
{%- if add_generation_prompt -%}
{{ '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' }}
{%- endif -%}
Perplexity Script
This was the script used for perplexity testing.
#!/bin/bash
# Activate the conda environment
source ~/miniconda3/etc/profile.d/conda.sh
conda activate exllamav2
# Set the model name and bit size
MODEL_NAME="c4ai-command-r-plus"
BIT_PRECISIONS=(8.0 7.5 7.0 6.5 5.5 2.75 2.25)
# MODEL_NAME="turboderp_command-r-plus-103B"
# BIT_PRECISIONS=(6.0 5.0 4.5 4.25 4.0 3.75 3.5 3.25 3.0 2.5)
# Print the markdown table header
echo "| Quant Level | Perplexity Score |"
echo "|-------------|------------------|"
for BIT_PRECISION in "${BIT_PRECISIONS[@]}"
do
MODEL_DIR="models/${MODEL_NAME}_exl2_${BIT_PRECISION}bpw"
# MODEL_DIR="models/${MODEL_NAME}-exl2_${BIT_PRECISION}bpw"
if [ -d "$MODEL_DIR" ]; then
output=$(python test_inference.py -m "$MODEL_DIR" -gs 22,24 -ed data/wikitext/wikitext-2-v1.parquet)
score=$(echo "$output" | grep -oP 'Evaluation perplexity: \K[\d.]+')
echo "| $BIT_PRECISION | $score |"
fi
done
Quant Details
This is the script used for quantization.
#!/bin/bash
# Activate the conda environment
source ~/miniconda3/etc/profile.d/conda.sh
conda activate exllamav2
# Set the model name and bit size
MODEL_NAME="c4ai-command-r-plus"
# Define variables
MODEL_DIR="models/$MODEL_NAME"
OUTPUT_DIR="exl2_$MODEL_NAME"
MEASUREMENT_FILE="measurements/$MODEL_NAME.json"
# Create the measurement file if needed
if [ ! -f "$MEASUREMENT_FILE" ]; then
echo "Creating $MEASUREMENT_FILE"
# Create directories
if [ -d "$OUTPUT_DIR" ]; then
rm -r "$OUTPUT_DIR"
fi
mkdir "$OUTPUT_DIR"
python convert.py -i $MODEL_DIR -o $OUTPUT_DIR -nr -om $MEASUREMENT_FILE
fi
# Choose one of the below. Either create a single quant for testing or a batch of them.
# BIT_PRECISIONS=(5.0)
BIT_PRECISIONS=(8.0 7.5 6.5 5.5 2.75 2.25)
for BIT_PRECISION in "${BIT_PRECISIONS[@]}"
do
CONVERTED_FOLDER="models/${MODEL_NAME}_exl2_${BIT_PRECISION}bpw"
# If it doesn't already exist, make the quant
if [ ! -d "$CONVERTED_FOLDER" ]; then
echo "Creating $CONVERTED_FOLDER"
# Create directories
if [ -d "$OUTPUT_DIR" ]; then
rm -r "$OUTPUT_DIR"
fi
mkdir "$OUTPUT_DIR"
mkdir "$CONVERTED_FOLDER"
# Run conversion commands
python convert.py -i $MODEL_DIR -o $OUTPUT_DIR -nr -m $MEASUREMENT_FILE -b $BIT_PRECISION -cf $CONVERTED_FOLDER
fi
done
- Downloads last month
- 11