Views
No views yet


pip install git+https://github.com/huggingface/transformers.pipeline abstraction or by leveraging the Auto classes with the generate() function.1import transformers
2import torch
3
4model_id = "MagpieLM-8B-Chat-v0.1"
5
6pipeline = transformers.pipeline(
7 "text-generation",
8 model=model_id,
9 model_kwargs={"torch_dtype": torch.bfloat16},
10 device_map="auto",
11)
12
13messages = [
14 {"role": "system", "content": "You are Magpie, a friendly AI assistant."},
15 {"role": "user", "content": "Who are you?"},
16]
17
18outputs = pipeline(
19 messages,
20 max_new_tokens=256,
21)
22print(outputs[0]["generated_text"][-1])0.4.11base_model: meta-llama/Meta-Llama-3.1-8B
2model_type: LlamaForCausalLM
3tokenizer_type: AutoTokenizer
4chat_template: llama3
5
6load_in_8bit: false
7load_in_4bit: false
8strict: false
9main_process_port: 0
10
11datasets:
12 - path: Magpie-Align/MagpieLM-SFT-Data-v0.1
13 type: sharegpt
14 conversation: llama3
15
16dataset_prepared_path: last_run_prepared
17val_set_size: 0.001
18output_dir: axolotl_out/MagpieLM-8B-SFT-v0.1
19
20sequence_len: 8192
21sample_packing: true
22eval_sample_packing: false
23pad_to_sequence_len: true
24
25wandb_project: SynDa
26wandb_entity:
27wandb_watch:
28wandb_name: MagpieLM-8B-SFT-v0.1
29wandb_log_model:
30hub_model_id: Magpie-Align/MagpieLM-8B-SFT-v0.1
31
32gradient_accumulation_steps: 32
33micro_batch_size: 1
34num_epochs: 2
35optimizer: paged_adamw_8bit
36lr_scheduler: cosine
37learning_rate: 2e-5
38
39train_on_inputs: false
40group_by_length: false
41bf16: auto
42fp16:
43tf32: false
44
45gradient_checkpointing: true
46gradient_checkpointing_kwargs:
47 use_reentrant: false
48early_stopping_patience:
49resume_from_checkpoint:
50logging_steps: 1
51xformers_attention:
52flash_attention: true
53
54warmup_ratio: 0.1
55evals_per_epoch: 5
56eval_table_size:
57saves_per_epoch:
58debug:
59deepspeed:
60weight_decay: 0.0
61fsdp:
62fsdp_config:
63special_tokens:
64 pad_token: <|end_of_text|>| Training Loss | Epoch | Step | Validation Loss | Rewards/chosen | Rewards/rejected | Rewards/accuracies | Rewards/margins | Logps/rejected | Logps/chosen | Logits/rejected | Logits/chosen |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.686 | 0.0653 | 100 | 0.6856 | -0.0491 | -0.0616 | 0.6480 | 0.0125 | -471.3315 | -478.8181 | -0.7034 | -0.7427 |
| 0.6218 | 0.1306 | 200 | 0.6277 | -0.6128 | -0.7720 | 0.6960 | 0.1591 | -542.3653 | -535.1920 | -0.7771 | -0.8125 |
| 0.5705 | 0.1959 | 300 | 0.5545 | -2.4738 | -3.0052 | 0.7270 | 0.5314 | -765.6894 | -721.2881 | -0.7894 | -0.8230 |
| 0.4606 | 0.2612 | 400 | 0.5081 | -2.6780 | -3.3782 | 0.7560 | 0.7002 | -802.9893 | -741.7116 | -0.6813 | -0.7247 |
| 0.4314 | 0.3266 | 500 | 0.4787 | -3.6697 | -4.6026 | 0.7630 | 0.9329 | -925.4283 | -840.8740 | -0.6189 | -0.6691 |
| 0.449 | 0.3919 | 600 | 0.4533 | -3.7414 | -4.8019 | 0.7820 | 1.0604 | -945.3563 | -848.0514 | -0.6157 | -0.6681 |
| 0.4538 | 0.4572 | 700 | 0.4350 | -4.3858 | -5.6549 | 0.7890 | 1.2690 | -1030.6561 | -912.4920 | -0.5789 | -0.6331 |
| 0.35 | 0.5225 | 800 | 0.4186 | -4.7129 | -6.1662 | 0.8010 | 1.4533 | -1081.7843 | -945.1964 | -0.5778 | -0.6347 |
| 0.4153 | 0.5878 | 900 | 0.4108 | -4.9836 | -6.5320 | 0.7970 | 1.5484 | -1118.3677 | -972.2631 | -0.5895 | -0.6474 |
| 0.3935 | 0.6531 | 1000 | 0.3999 | -4.4303 | -5.9370 | 0.8110 | 1.5067 | -1058.8646 | -916.9379 | -0.6016 | -0.6598 |
| 0.3205 | 0.7184 | 1100 | 0.3950 | -5.1884 | -6.8827 | 0.8010 | 1.6943 | -1153.4371 | -992.7452 | -0.5846 | -0.6452 |
| 0.3612 | 0.7837 | 1200 | 0.3901 | -5.0426 | -6.7179 | 0.8040 | 1.6753 | -1136.9619 | -978.1701 | -0.6046 | -0.6637 |
| 0.3058 | 0.8490 | 1300 | 0.3877 | -5.1224 | -6.8428 | 0.8040 | 1.7204 | -1149.4465 | -986.1475 | -0.6087 | -0.6690 |
| 0.3467 | 0.9144 | 1400 | 0.3871 | -5.2335 | -6.9809 | 0.8090 | 1.7474 | -1163.2629 | -997.2610 | -0.6071 | -0.6672 |
| 0.3197 | 0.9797 | 1500 | 0.3867 | -5.1502 | -6.8793 | 0.8080 | 1.7291 | -1153.0979 | -988.9237 | -0.6120 | -0.6722 |
1# Customized Configs
2model_name_or_path: Magpie-Align/MagpieLM-8B-SFT-v0.1
3hub_model_id: Magpie-Align/MagpieLM-8B-Chat-v0.1
4output_dir: alignment_handbook_out/MagpieLM-8B-Chat-v0.1
5run_name: MagpieLM-8B-Chat-v0.1
6
7dataset_mixer:
8 Magpie-Align/MagpieLM-DPO-Data-v0.1: 1.0
9dataset_splits:
10- train
11- test
12preprocessing_num_workers: 24
13
14# DPOTrainer arguments
15bf16: true
16beta: 0.01
17learning_rate: 2.0e-7
18gradient_accumulation_steps: 16
19per_device_train_batch_size: 2
20per_device_eval_batch_size: 4
21num_train_epochs: 1
22max_length: 2048
23max_prompt_length: 1800
24warmup_ratio: 0.1
25logging_steps: 1
26lr_scheduler_type: cosine
27optim: adamw_torch
28
29torch_dtype: null
30# use_flash_attention_2: true
31do_eval: true
32evaluation_strategy: steps
33eval_steps: 100
34gradient_checkpointing: true
35gradient_checkpointing_kwargs:
36 use_reentrant: False
37log_level: info
38push_to_hub: true
39save_total_limit: 0
40seed: 42
41report_to:
42- wandb@article{xu2024magpie,
title={Magpie: Alignment Data Synthesis from Scratch by Prompting Aligned LLMs with Nothing},
author={Zhangchen Xu and Fengqing Jiang and Luyao Niu and Yuntian Deng and Radha Poovendran and Yejin Choi and Bill Yuchen Lin},
year={2024},
eprint={2406.08464},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@article{xu2024stronger,
title={Stronger Models are NOT Stronger Teachers for Instruction Tuning},
author={Xu, Zhangchen and Jiang, Fengqing and Niu, Luyao and Lin, Bill Yuchen and Poovendran, Radha},
journal={arXiv preprint arXiv:2411.07133},
year={2024}
}