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-4B-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: nvidia/Llama-3.1-Minitron-4B-Width-Base
2model_type: AutoModelForCausalLM
3tokenizer_type: AutoTokenizer
4chat_template: llama3
5
6load_in_8bit: false
7load_in_4bit: false
8strict: false
9
10datasets:
11 - path: Magpie-Align/MagpieLM-SFT-Data-v0.1
12 type: sharegpt
13 conversation: llama3
14dataset_prepared_path: last_run_prepared
15val_set_size: 0.001
16output_dir: axolotl_out/MagpieLM-4B-SFT-v0.1
17
18sequence_len: 8192
19sample_packing: true
20eval_sample_packing: false
21pad_to_sequence_len: true
22
23wandb_project: SynDa
24wandb_entity:
25wandb_watch:
26wandb_name: Llama3.1-MagpieLM-4B-SFT-v0.1
27wandb_log_model:
28hub_model_id: Magpie-Align/MagpieLM-4B-SFT-v0.1
29
30gradient_accumulation_steps: 32
31micro_batch_size: 1
32num_epochs: 2
33optimizer: paged_adamw_8bit
34lr_scheduler: cosine
35learning_rate: 2e-5
36
37train_on_inputs: false
38group_by_length: false
39bf16: true
40fp16:
41tf32: false
42
43gradient_checkpointing: true
44gradient_checkpointing_kwargs:
45 use_reentrant: false
46early_stopping_patience:
47resume_from_checkpoint:
48logging_steps: 1
49xformers_attention:
50flash_attention: true
51
52warmup_ratio: 0.1
53evals_per_epoch: 5
54eval_table_size:
55saves_per_epoch: 1
56debug:
57deepspeed:
58weight_decay: 0.0
59fsdp:
60fsdp_config:
61special_tokens:
62 pad_token: <|end_of_text|>
63| Training Loss | Epoch | Step | Validation Loss | Rewards/chosen | Rewards/rejected | Rewards/accuracies | Rewards/margins | Logps/rejected | Logps/chosen | Logits/rejected | Logits/chosen |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.6911 | 0.0653 | 100 | 0.6912 | -0.0026 | -0.0066 | 0.5640 | 0.0041 | -502.9037 | -510.6042 | -1.7834 | -1.7781 |
| 0.6703 | 0.1306 | 200 | 0.6713 | -0.1429 | -0.1981 | 0.6380 | 0.0552 | -522.0521 | -524.6394 | -1.7686 | -1.7593 |
| 0.6306 | 0.1959 | 300 | 0.6347 | -0.6439 | -0.8210 | 0.6840 | 0.1770 | -584.3356 | -574.7375 | -1.7536 | -1.7436 |
| 0.5831 | 0.2612 | 400 | 0.5932 | -1.5155 | -1.8774 | 0.7070 | 0.3619 | -689.9788 | -661.8920 | -1.6963 | -1.6877 |
| 0.5447 | 0.3266 | 500 | 0.5645 | -2.1858 | -2.7052 | 0.7110 | 0.5195 | -772.7636 | -728.9221 | -1.6249 | -1.6207 |
| 0.5896 | 0.3919 | 600 | 0.5453 | -2.3771 | -2.9747 | 0.7180 | 0.5976 | -799.7122 | -748.0584 | -1.5836 | -1.5847 |
| 0.5342 | 0.4572 | 700 | 0.5305 | -2.6231 | -3.3063 | 0.7350 | 0.6832 | -832.8744 | -772.6592 | -1.5454 | -1.5524 |
| 0.511 | 0.5225 | 800 | 0.5177 | -3.0517 | -3.8393 | 0.7400 | 0.7876 | -886.1714 | -815.5145 | -1.5160 | -1.5273 |
| 0.5007 | 0.5878 | 900 | 0.5088 | -3.0925 | -3.9197 | 0.7540 | 0.8273 | -894.2120 | -819.5908 | -1.5007 | -1.5144 |
| 0.485 | 0.6531 | 1000 | 0.5033 | -3.1305 | -3.9863 | 0.7630 | 0.8558 | -900.8680 | -823.3940 | -1.4834 | -1.4997 |
| 0.4307 | 0.7184 | 1100 | 0.4989 | -3.1387 | -4.0097 | 0.7610 | 0.8710 | -903.2113 | -824.2159 | -1.4728 | -1.4911 |
| 0.5403 | 0.7837 | 1200 | 0.4964 | -3.3418 | -4.2574 | 0.7620 | 0.9156 | -927.9747 | -844.5242 | -1.4641 | -1.4822 |
| 0.5182 | 0.8490 | 1300 | 0.4952 | -3.3255 | -4.2430 | 0.7600 | 0.9175 | -926.5396 | -842.8945 | -1.4601 | -1.4788 |
| 0.5165 | 0.9144 | 1400 | 0.4943 | -3.3308 | -4.2525 | 0.7600 | 0.9217 | -927.4913 | -843.4282 | -1.4610 | -1.4799 |
| 0.5192 | 0.9797 | 1500 | 0.4942 | -3.3377 | -4.2603 | 0.7620 | 0.9226 | -928.2655 | -844.1144 | -1.4591 | -1.4783 |
1# Customized Configs
2model_name_or_path: Magpie-Align/MagpieLM-4B-SFT-v0.1
3hub_model_id: Magpie-Align/MagpieLM-4B-Chat-v0.1
4output_dir: alignment_handbook_out/MagpieLM-4B-Chat-v0.1
5run_name: MagpieLM-4B-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: 1.5e-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}
}