π Model Description
Quantization made by Richard Erkhov.
bagel-7b-v0.1 - GGUF
- Model creator: https://huggingface.co/jondurbin/
- Original model: https://huggingface.co/jondurbin/bagel-7b-v0.1/
| Name | Quant method | Size |
|---|---|---|
| bagel-7b-v0.1.Q2K.gguf | Q2K | 2.53GB |
| bagel-7b-v0.1.IQ3XS.gguf | IQ3XS | 2.81GB |
| bagel-7b-v0.1.IQ3S.gguf | IQ3S | 2.96GB |
| bagel-7b-v0.1.Q3KS.gguf | Q3K_S | 2.95GB |
| bagel-7b-v0.1.IQ3M.gguf | IQ3M | 3.06GB |
| bagel-7b-v0.1.Q3K.gguf | Q3K | 3.28GB |
| bagel-7b-v0.1.Q3KM.gguf | Q3K_M | 3.28GB |
| bagel-7b-v0.1.Q3KL.gguf | Q3K_L | 3.56GB |
| bagel-7b-v0.1.IQ4XS.gguf | IQ4XS | 3.67GB |
| bagel-7b-v0.1.Q40.gguf | Q40 | 3.83GB |
| bagel-7b-v0.1.IQ4NL.gguf | IQ4NL | 3.87GB |
| bagel-7b-v0.1.Q4KS.gguf | Q4K_S | 3.86GB |
| bagel-7b-v0.1.Q4K.gguf | Q4K | 4.07GB |
| bagel-7b-v0.1.Q4KM.gguf | Q4K_M | 4.07GB |
| bagel-7b-v0.1.Q41.gguf | Q41 | 4.24GB |
| bagel-7b-v0.1.Q50.gguf | Q50 | 4.65GB |
| bagel-7b-v0.1.Q5KS.gguf | Q5K_S | 4.65GB |
| bagel-7b-v0.1.Q5K.gguf | Q5K | 4.78GB |
| bagel-7b-v0.1.Q5KM.gguf | Q5K_M | 4.78GB |
| bagel-7b-v0.1.Q51.gguf | Q51 | 5.07GB |
| bagel-7b-v0.1.Q6K.gguf | Q6K | 5.53GB |
| bagel-7b-v0.1.Q80.gguf | Q80 | 7.17GB |
Original model description:
license: apache-2.0
datasets:
- ai2arc
- unalignment/spicy-3.1
- codeparrot/apps
- facebook/belebele
- boolq
- jondurbin/cinematika-v0.1
- drop
- lmsys/lmsys-chat-1m
- TIGER-Lab/MathInstruct
- cais/mmlu
- Muennighoff/natural-instructions
- openbookqa
- piqa
- Vezora/Tested-22k-Python-Alpaca
- cakiki/rosetta-code
- Open-Orca/SlimOrca
- spider
- squadv2
- migtissera/Synthia-v1.3
- datasets/winogrande
A bagel, with everything (except DPO)
Overview
This is the pre-DPO version of the mistral-7b model fine-tuned with https://github.com/jondurbin/bagel
You probably want the higher performing model that underwent DPO: https://huggingface.co/jondurbin/bagel-dpo-7b-v0.1
The only benefit to this model is that it is less "truthful", for roleplaying and other types of scenarios that may benefit more from the SFT-only tune.
Data selection.
The first step in the process is creating a dataset.
In this case, we're actually creating a composite dataset, consisting of both supervised fine-tuning data (SFT) and direct preference optimization (DPO) data.
All instruction data, that is, data that is not plain text (like project Gutenberg and items from Cinematika) or DPO, is converted into ShareGPT format so it's easier to work with.
See the corresponding code in bagel/data_sources/*.py in the repo linked above for full implementation for each data source.
Deduplication is done by creating a uuid v5 of the instruction/text, then only adding items not previously seen (where datasets are loaded in order of the confidence score I assign them).
This means that if an instruction is in data source "Foo" with confidence 4 as well as in data source "Bar" with confidence score 2, only the entry from "Foo" will be taken.
SFT data sources
Yes, you will see benchmark names in the list, but this only uses the train splits, and a decontamination by cosine similarity is performed at the end as a sanity check
- Abstraction and reasoning dataset, useful in measuring "intelligence" to a certain extent. - Variety of categories of synthetic instructions generated by gpt-4. - Python coding dataset with 10k problems. - Multi-lingual reading comprehension dataset. - Corpus of yes/no questions (which can be surprisingly difficult for AI to answer apparently?)- cinematika (instruction and plain text)
- gutenberg (plain text)
- lmsyschat_1m (only gpt-4 items, also used for DPO)
Only the train splits were used (if a split was provided), and an additional pass of decontamination is performed using approximate nearest neighbor search (via faiss).
Prompt formatting
In sticking with the theme of the bagel, I didn't want to use a single prompt format, so I used 4 - vicuna, llama-2, alpaca, and chat-ml (sorta).
I also didn't want to randomly select a single prompt format for each item (hoping each instruction would generalize more when used in a variety of prompt formats), so each instruction is actually converted into every prompt format.
This means each epoch of our fine-tune is really basically 4 epochs. So, for the fine-tunes, I would recommend only doing 1 epoch (or 0.75 epochs). I am testing with a single epoch using a relatively low learning rate.
Alpaca (sort of)
Below is an instruction that describes a task. Write a response that appropriately completes the request.
Instruction:
{system prompt, if provided}
{instruction}
Response:
The main difference here is that because of the dataset formatting and variety of data sources, it would have been much to tedious to add an ### Input: block, so the inputs are just in the instruction section.
Vicuna
{system prompt, if provided, randomly defaulting to "A chat between a user and an unbiased, uncensored assistant."}
USER: {instruction}
ASSISTANT:
ChatML (sort of)
I don't really understand the point of having special tokens for <|imstart|> and <|imend|>, because in practice they just act as BOS and EOS tokens (but, please correct me if I'm wrong).
So, instead of:
{bos}<|im_start|>{role}
{text}
<|im_end|>{eos}
I just changed it to:
{bos}{role}
{text}
{eos}
In practice, this would mean tokenization code like such:
tokenizer = AutoTokenizer.from_pretrained('mistralai/mistral-7b-v0.1')
input_str = f"""system
You are a goat.
{tokenizer.eos_token}
{tokenizer.bos_token}user
Tell me how to fry an egg.
{tokenizer.eos_token}
{tokenizer.bos_token}assistant
"""
inputs = tokenizer(inputstr, returntensors="pt")
If you really want to use <|imstart|> and <|imend|>, just update your tokenizerconfig.json to use <|imstart|> instead of and <|im_end|> instead of and when tokenizing. And if you still don't like what I've done to this chat-ml-ish format, feel free to cry into your pillow or fork the code and do a new fine-tune.
Llama-2 chat
[INST] <<SYS>>
{system}
<</SYS>>
{instruction} [/INST]
Fine-tune
Note: I actually used my fork of qlora's train.py for this, but I'm porting it to a minified version here, not tested yet!
More notes: I stopped the fine-tune around 50% because of budget constraints - it's a lot of data...
export BASE_DIR=/workspace
export WANDBAPIKEY=[redacted]
export WANDB_PROJECT=bagel-7b-v0.1
Run the pretraining.
accelerate launch bagel/tune/sft.py \
--modelnameorpath $BASEDIR/mistral-7b \
--finaloutputdir $BASEDIR/$WANDBPROJECT \
--outputdir $BASEDIR/$WANDB_PROJECT-workdir \
--numtrainepochs 1 \
--logging_steps 1 \
--save_strategy steps \
--save_steps 200 \
--savetotallimit 5 \
--data_seed 42 \
--evaluation_strategy steps \
--evaldatasetsize 0.0006 \
--eval_steps 200 \
--maxnewtokens 4096 \
--dataloadernumworkers 3 \
--logging_strategy steps \
--removeunusedcolumns False \
--do_train \
--full_finetune \
--bf16 \
--bits 16 \
--optim adamw_torch \
--lrschedulertype linear \
--dataset $BASE_DIR/bagel/bagel-input-output-v0.1.parquet \
--dataset_format input-output \
--modelmaxlen 4096 \
--perdevicetrainbatchsize 8 \
--learning_rate 3.5e-7 \
--warmup_ratio 0.005 \
--adam_beta2 0.999 \
--maxgradnorm 0.3 \
--weight_decay 0.001 \
--seed 42 \
--report_to wandb \
--gradient_checkpointing True \
--gradientaccumulationsteps 4 \
--skipexcesslength False \
--ddpfindunused_parameters False \
--useflashattention_2 \
--deepspeed deepspeed.json
Deepspeed configuration:
{
"gradientaccumulationsteps": "auto",
"gradient_clipping": "auto",
"trainbatchsize": "auto",
"trainmicrobatchsizeper_gpu": "auto",
"bf16": {
"enabled": true
},
"zero_optimization": {
"stage": 2,
"contiguous_gradients": true,
"overlap_comm": true,
"reduce_scatter": true,
"reducebucketsize": 5e8,
"allgatherbucketsize": 5e8
}
}
π GGUF File List
| π Filename | π¦ Size | β‘ Download |
|---|---|---|
|
bagel-7b-v0.1.IQ3_M.gguf
LFS
Q3
|
3.06 GB | Download |
|
bagel-7b-v0.1.IQ3_S.gguf
LFS
Q3
|
2.96 GB | Download |
|
bagel-7b-v0.1.IQ3_XS.gguf
LFS
Q3
|
2.81 GB | Download |
|
bagel-7b-v0.1.IQ4_NL.gguf
LFS
Q4
|
3.87 GB | Download |
|
bagel-7b-v0.1.IQ4_XS.gguf
LFS
Q4
|
3.67 GB | Download |
|
bagel-7b-v0.1.Q2_K.gguf
LFS
Q2
|
2.53 GB | Download |
|
bagel-7b-v0.1.Q3_K.gguf
LFS
Q3
|
3.28 GB | Download |
|
bagel-7b-v0.1.Q3_K_L.gguf
LFS
Q3
|
3.56 GB | Download |
|
bagel-7b-v0.1.Q3_K_M.gguf
LFS
Q3
|
3.28 GB | Download |
|
bagel-7b-v0.1.Q3_K_S.gguf
LFS
Q3
|
2.95 GB | Download |
|
bagel-7b-v0.1.Q4_0.gguf
Recommended
LFS
Q4
|
3.83 GB | Download |
|
bagel-7b-v0.1.Q4_1.gguf
LFS
Q4
|
4.24 GB | Download |
|
bagel-7b-v0.1.Q4_K.gguf
LFS
Q4
|
4.07 GB | Download |
|
bagel-7b-v0.1.Q4_K_M.gguf
LFS
Q4
|
4.07 GB | Download |
|
bagel-7b-v0.1.Q4_K_S.gguf
LFS
Q4
|
3.86 GB | Download |
|
bagel-7b-v0.1.Q5_0.gguf
LFS
Q5
|
4.65 GB | Download |
|
bagel-7b-v0.1.Q5_1.gguf
LFS
Q5
|
5.07 GB | Download |
|
bagel-7b-v0.1.Q5_K.gguf
LFS
Q5
|
4.78 GB | Download |
|
bagel-7b-v0.1.Q5_K_M.gguf
LFS
Q5
|
4.78 GB | Download |
|
bagel-7b-v0.1.Q5_K_S.gguf
LFS
Q5
|
4.65 GB | Download |
|
bagel-7b-v0.1.Q6_K.gguf
LFS
Q6
|
5.53 GB | Download |
|
bagel-7b-v0.1.Q8_0.gguf
LFS
Q8
|
7.17 GB | Download |