transformers safetensors qwen2 text-generation axolotl generated_from_trainer phi phi2 einstein instruct finetune chatml gpt4 synthetic data science physics chemistry biology math conversational en dataset:allenai/ai2_arc dataset:camel-ai/physics dataset:camel-ai/chemistry dataset:camel-ai/biology dataset:camel-ai/math dataset:metaeval/reclor dataset:openbookqa dataset:mandyyyyii/scibench dataset:derek-thomas/ScienceQA dataset:TIGER-Lab/ScienceEval dataset:jondurbin/airoboros-3.2 dataset:LDJnr/Capybara dataset:Cot-Alpaca-GPT4-From-OpenHermes-2.5 dataset:STEM-AI-mtl/Electrical-engineering dataset:knowrohit07/saraswati-stem dataset:sablo/oasst2_curated dataset:glaiveai/glaive-code-assistant dataset:lmsys/lmsys-chat-1m dataset:TIGER-Lab/MathInstruct dataset:bigbio/med_qa dataset:meta-math/MetaMathQA-40K dataset:piqa dataset:scibench dataset:sciq dataset:Open-Orca/SlimOrca dataset:migtissera/Synthia-v1.3 arxiv:2305.14314 base_model:Qwen/Qwen1.5-32B base_model:finetune:Qwen/Qwen1.5-32B license:other autotrain_compatible text-generation-inference endpoints_compatible region:us
---
base_model: Qwen/Qwen1.5-32B
datasets:
- allenai/ai2_arc
- camel-ai/physics
- camel-ai/chemistry
- camel-ai/biology
- camel-ai/math
- metaeval/reclor
- openbookqa
- mandyyyyii/scibench
- derek-thomas/ScienceQA
- TIGER-Lab/ScienceEval
- jondurbin/airoboros-3.2
- LDJnr/Capybara
- Cot-Alpaca-GPT4-From-OpenHermes-2.5
- STEM-AI-mtl/Electrical-engineering
- knowrohit07/saraswati-stem
- sablo/oasst2_curated
- glaiveai/glaive-code-assistant
- lmsys/lmsys-chat-1m
- TIGER-Lab/MathInstruct
- bigbio/med_qa
- meta-math/MetaMathQA-40K
- openbookqa
- piqa
- metaeval/reclor
- derek-thomas/ScienceQA
- scibench
- sciq
- Open-Orca/SlimOrca
- migtissera/Synthia-v1.3
- TIGER-Lab/ScienceEval
language:
- en
license: other
tags:
- axolotl
- generated_from_trainer
- phi
- phi2
- einstein
- instruct
- finetune
- chatml
- gpt4
- synthetic data
- science
- physics
- chemistry
- biology
- math
---
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6468ce47e134d050a58aa89c/VTacthtA6N97SqD23WtwB.png)

# 🔬 Einstein-v4-Qwen-1.5-32B

This model is a [QLoRA](https://arxiv.org/abs/2305.14314) fine-tuned version of [Qwen/Qwen1.5-32B](https://huggingface.co/Qwen/Qwen1.5-32B) on diverse datasets.

This model is finetuned using `8xRTX3090` + `1xRTXA6000` using [axolotl](https://github.com/OpenAccess-AI-Collective/axolotl).

This model's training was sponsored by [sablo.ai](https://sablo.ai). 

<details><summary>See axolotl config</summary>

axolotl version: `0.4.0`
```yaml
base_model: Qwen/Qwen1.5-32B
model_type: AutoModelForCausalLM
tokenizer_type: AutoTokenizer

load_in_8bit: false
load_in_4bit: true
strict: false

chat_template: chatml
datasets:
  - path: data/merged_all.json
    ds_type: json
    type: alpaca
    conversation: chatml

  - path: data/capybara_sharegpt.json
    ds_type: json
    type: sharegpt
    conversation: chatml

  - path: data/synthia-v1.3_sharegpt_12500.json
    ds_type: json
    type: sharegpt
    conversation: chatml  

  - path: data/cot_alpaca_gpt4_extracted_openhermes_2.5_sharegpt.json
    ds_type: json
    type: sharegpt
    conversation: chatml

  - path: data/slimorca_dedup_filtered_95k_sharegpt.json
    ds_type: json
    type: sharegpt
    conversation: chatml  

  - path: data/airoboros_3.2_without_contextual_slimorca_orca_sharegpt.json
    ds_type: json
    type: sharegpt
    conversation: chatml  

dataset_prepared_path: last_run_prepared
val_set_size: 0 # because we won't eval, out of memory :(
output_dir: ./Einstein-v4-Qwen-1.5-32B-model

sequence_len: 4096
sample_packing: true
pad_to_sequence_len: true
eval_sample_packing: false

adapter: qlora
lora_model_dir:
lora_r: 64
lora_alpha: 32
lora_dropout: 0.05
lora_target_linear: true
lora_fan_in_fan_out:
lora_modules_to_save: 
  - "embed_tokens"
  - "lm_head"

wandb_project: Einstein
wandb_entity:
wandb_watch:
wandb_name: Einstein-v4-Qwen-1.5-32B-qlora-2-epoch
wandb_log_model:
hub_model_id: Weyaxi/Einstein-v4-Qwen-1.5-32B

save_safetensors: true

gradient_accumulation_steps: 4
micro_batch_size: 1
num_epochs: 2
optimizer: adamw_bnb_8bit
lr_scheduler: cosine
learning_rate: 0.0002

train_on_inputs: false
group_by_length: false
bf16: true
fp16: false
tf32: false

gradient_checkpointing: true
early_stopping_patience:
resume_from_checkpoint:
local_rank:
logging_steps: 1
xformers_attention:
flash_attention: true

warmup_steps: 10
evals_per_epoch: 0 # because we won't eval, out of memory :(
eval_table_size:
eval_table_max_new_tokens: 128
saves_per_epoch: 2
debug:

deepspeed: zero3_bf16_cpuoffload_params.json
weight_decay: 0.0
fsdp:
fsdp_config:
special_tokens:
  bos_token: "<s>"
  eos_token: "<|im_end|>"
  unk_token: "<unk>"
tokens:
  - "<|im_start|>"
```
</details><br>

# 💬 Prompt Template

You can use this prompt template while using the model:

### ChatML

```
<|im_start|>system
{system}<|im_end|>
<|im_start|>user
{user}<|im_end|>
<|im_start|>assistant
{asistant}<|im_end|>
```

This prompt template is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating), which means you can format messages using the
`tokenizer.apply_chat_template()` method:

```python
messages = [
    {"role": "system", "content": "You are helpful AI asistant."},
    {"role": "user", "content": "Hello!"}
]
gen_input = tokenizer.apply_chat_template(message, return_tensors="pt")
model.generate(**gen_input)
```

# 🔄 Quantizationed versions

Quantizationed versions of this model is currently not available.

# 🎯 [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
Detailed results can be found [here](https://huggingface.co/datasets/open-llm-leaderboard/details_Weyaxi__Einstein-v4-Qwen-1.5-32B)

|             Metric              |Value|
|---------------------------------|----:|
|Avg.                             |68.54|
|AI2 Reasoning Challenge (25-Shot)|62.37|
|HellaSwag (10-Shot)              |83.85|
|MMLU (5-Shot)                    |74.04|
|TruthfulQA (0-shot)              |58.86|
|Winogrande (5-shot)              |80.43|
|GSM8k (5-shot)                   |51.71|


# 🤖 Additional information about training

This model is full fine-tuned for 2 epochs. 

Total number of steps was 3352.

<details><summary>Loss graph</summary>

![image/png](https://cdn-uploads.huggingface.co/production/uploads/6468ce47e134d050a58aa89c/0Vp8iDmXi4-XbQCiwQtNP.png)

</details><br>

# 🤝 Acknowledgments

Thanks to [sablo.ai](https://sablo.ai) for sponsoring this model.

Thanks to all the dataset authors mentioned in the datasets section.

Thanks to [axolotl](https://github.com/OpenAccess-AI-Collective/axolotl) for making the repository I used to make this model.

Thanks to all open source AI community.

[<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)

If you would like to support me:

[☕ Buy Me a Coffee](https://www.buymeacoffee.com/weyaxi)
