mirror of
https://github.com/wassname/alignment-handbook.git
synced 2026-06-27 17:47:01 +08:00
wip
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
3.10
|
||||||
Vendored
+22
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"workbench.colorCustomizations": {
|
||||||
|
"activityBar.activeBackground": "#ebae44",
|
||||||
|
"activityBar.background": "#ebae44",
|
||||||
|
"activityBar.foreground": "#15202b",
|
||||||
|
"activityBar.inactiveForeground": "#15202b99",
|
||||||
|
"activityBarBadge.background": "#0f9061",
|
||||||
|
"activityBarBadge.foreground": "#e7e7e7",
|
||||||
|
"commandCenter.border": "#15202b99",
|
||||||
|
"sash.hoverBorder": "#ebae44",
|
||||||
|
"statusBar.background": "#e49a18",
|
||||||
|
"statusBar.foreground": "#15202b",
|
||||||
|
"statusBarItem.hoverBackground": "#b67b13",
|
||||||
|
"statusBarItem.remoteBackground": "#e49a18",
|
||||||
|
"statusBarItem.remoteForeground": "#15202b",
|
||||||
|
"titleBar.activeBackground": "#e49a18",
|
||||||
|
"titleBar.activeForeground": "#15202b",
|
||||||
|
"titleBar.inactiveBackground": "#e49a1899",
|
||||||
|
"titleBar.inactiveForeground": "#15202b99"
|
||||||
|
},
|
||||||
|
"peacock.remoteColor": "#e49a18"
|
||||||
|
}
|
||||||
@@ -1,3 +1,14 @@
|
|||||||
|
I'm using this to train some simple base -> SFT models for my work
|
||||||
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
uv sync --no-build-isolation-package flash-attn
|
||||||
|
MAX_JOBS=10 pip install flash-attn --no-build-isolation
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Old readme
|
||||||
|
----
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://raw.githubusercontent.com/huggingface/alignment-handbook/main/assets/handbook.png">
|
<img src="https://raw.githubusercontent.com/huggingface/alignment-handbook/main/assets/handbook.png">
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
[project]
|
||||||
|
name = "alignment-handbook"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Add your description here"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.10"
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
"accelerate>=0.29.2",
|
||||||
|
"bitsandbytes>=0.43.0",
|
||||||
|
"black>=24.4.2",
|
||||||
|
"datasets>=2.18.0",
|
||||||
|
"deepspeed>=0.14.4",
|
||||||
|
"einops>=0.6.1",
|
||||||
|
"evaluate==0.4.0",
|
||||||
|
"flake8>=6.0.0",
|
||||||
|
"hf-doc-builder>=0.4.0",
|
||||||
|
"hf_transfer>=0.1.4",
|
||||||
|
"huggingface-hub>=0.19.2,<1.0",
|
||||||
|
"isort>=5.12.0",
|
||||||
|
"ninja>=1.11.1",
|
||||||
|
"numpy>=1.24.2",
|
||||||
|
"packaging>=23.0",
|
||||||
|
"parameterized>=0.9.0",
|
||||||
|
"peft>=0.9.0",
|
||||||
|
"protobuf<=3.20.2", # Needed to avoid conflicts with `transformers`
|
||||||
|
"pytest",
|
||||||
|
"safetensors>=0.3.3",
|
||||||
|
"sentencepiece>=0.1.99",
|
||||||
|
"scipy",
|
||||||
|
"tensorboard",
|
||||||
|
"torch>=2.1.2",
|
||||||
|
"transformers>=4.39.3",
|
||||||
|
"trl>=0.9.6,<0.13.0",
|
||||||
|
"jinja2>=3.0.0",
|
||||||
|
"tqdm>=4.64.1",
|
||||||
|
"wheel>=0.45.1",
|
||||||
|
"setuptools>=80.9.0",
|
||||||
|
"hatchling>=1.27.0",
|
||||||
|
"editables>=0.5",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
[dependency-groups]
|
||||||
|
dev = [
|
||||||
|
"pytest",
|
||||||
|
"ipykernel>=6.29.5",
|
||||||
|
]
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["hatchling"]
|
||||||
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
packages = ["src"]
|
||||||
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Model arguments
|
||||||
|
model_name_or_path: NousResearch/Llama-3.2-1B
|
||||||
|
model_revision: main
|
||||||
|
torch_dtype: bfloat16
|
||||||
|
attn_implementation: flash_attention_2
|
||||||
|
|
||||||
|
# Data training arguments
|
||||||
|
chat_template: "{% set loop_messages = messages %}{% for message in loop_messages %}{% set content = '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' %}{% if loop.index0 == 0 %}{% set content = bos_token + content %}{% endif %}{{ content }}{% endfor %}{% if add_generation_prompt %}{{ '<|start_header_id|>assistant<|end_header_id|>\n\n' }}{% endif %}"
|
||||||
|
dataset_mixer:
|
||||||
|
wassname/ultrachat_200k_filtered: 1.0
|
||||||
|
dataset_splits:
|
||||||
|
- train_sft
|
||||||
|
- test_sft
|
||||||
|
preprocessing_num_workers: 12
|
||||||
|
|
||||||
|
# SFT trainer config
|
||||||
|
bf16: true
|
||||||
|
do_eval: true
|
||||||
|
evaluation_strategy: steps
|
||||||
|
eval_steps: 200
|
||||||
|
gradient_accumulation_steps: 32
|
||||||
|
gradient_checkpointing: true
|
||||||
|
gradient_checkpointing_kwargs:
|
||||||
|
use_reentrant: False
|
||||||
|
hub_model_id: llama-3.2-1b-sft
|
||||||
|
hub_strategy: every_save
|
||||||
|
learning_rate: 2.0e-04
|
||||||
|
log_level: info
|
||||||
|
logging_steps: 5
|
||||||
|
logging_strategy: steps
|
||||||
|
lr_scheduler_type: cosine
|
||||||
|
max_seq_length: 2048
|
||||||
|
max_steps: -1
|
||||||
|
num_train_epochs: 3
|
||||||
|
output_dir: /workspace/checkpoints_new/llama-3-2-1b-sft
|
||||||
|
run_name: llama-3-2-1b-sft
|
||||||
|
overwrite_output_dir: true
|
||||||
|
per_device_eval_batch_size: 8
|
||||||
|
per_device_train_batch_size: 8
|
||||||
|
push_to_hub: false
|
||||||
|
remove_unused_columns: true
|
||||||
|
report_to:
|
||||||
|
- wandb
|
||||||
|
save_strategy: "steps"
|
||||||
|
save_steps: 1000000
|
||||||
|
save_total_limit: 1
|
||||||
|
seed: 42
|
||||||
|
warmup_ratio: 0.1
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Model arguments
|
||||||
|
model_name_or_path: NousResearch/Llama-3.2-1B
|
||||||
|
model_revision: main
|
||||||
|
torch_dtype: bfloat16
|
||||||
|
attn_implementation: flash_attention_2
|
||||||
|
|
||||||
|
# Data training arguments
|
||||||
|
chat_template: "{% set loop_messages = messages %}{% for message in loop_messages %}{% set content = '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' %}{% if loop.index0 == 0 %}{% set content = bos_token + content %}{% endif %}{{ content }}{% endfor %}{% if add_generation_prompt %}{{ '<|start_header_id|>assistant<|end_header_id|>\n\n' }}{% endif %}"
|
||||||
|
dataset_mixer:
|
||||||
|
wassname/ultrachat_200k_filtered: 1.0
|
||||||
|
dataset_splits:
|
||||||
|
- train_sft
|
||||||
|
- test_sft
|
||||||
|
preprocessing_num_workers: 12
|
||||||
|
|
||||||
|
# SFT trainer config
|
||||||
|
bf16: true
|
||||||
|
do_eval: true
|
||||||
|
evaluation_strategy: steps
|
||||||
|
eval_steps: 200
|
||||||
|
gradient_accumulation_steps: 32
|
||||||
|
gradient_checkpointing: true
|
||||||
|
gradient_checkpointing_kwargs:
|
||||||
|
use_reentrant: False
|
||||||
|
hub_model_id: llama-3.2-1b-sft
|
||||||
|
hub_strategy: every_save
|
||||||
|
learning_rate: 2.0e-04
|
||||||
|
log_level: info
|
||||||
|
logging_steps: 5
|
||||||
|
logging_strategy: steps
|
||||||
|
lr_scheduler_type: cosine
|
||||||
|
max_seq_length: 2048
|
||||||
|
max_steps: -1
|
||||||
|
num_train_epochs: 3
|
||||||
|
output_dir: /workspace/checkpoints_new/llama-3-2-1b-sft
|
||||||
|
run_name: llama-3-2-1b-sft
|
||||||
|
overwrite_output_dir: true
|
||||||
|
per_device_eval_batch_size: 8
|
||||||
|
per_device_train_batch_size: 8
|
||||||
|
push_to_hub: false
|
||||||
|
remove_unused_columns: true
|
||||||
|
report_to:
|
||||||
|
- wandb
|
||||||
|
save_strategy: "steps"
|
||||||
|
save_steps: 1000000
|
||||||
|
save_total_limit: 1
|
||||||
|
seed: 42
|
||||||
|
warmup_ratio: 0.1
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Model arguments
|
||||||
|
model_name_or_path: tanliboy/Llama-3.2-3B
|
||||||
|
model_revision: main
|
||||||
|
torch_dtype: bfloat16
|
||||||
|
attn_implementation: flash_attention_2
|
||||||
|
|
||||||
|
# Data training arguments
|
||||||
|
chat_template: "{% set loop_messages = messages %}{% for message in loop_messages %}{% set content = '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' %}{% if loop.index0 == 0 %}{% set content = bos_token + content %}{% endif %}{{ content }}{% endfor %}{% if add_generation_prompt %}{{ '<|start_header_id|>assistant<|end_header_id|>\n\n' }}{% endif %}"
|
||||||
|
dataset_mixer:
|
||||||
|
wassname/ultrachat_200k_filtered: 1.0
|
||||||
|
dataset_splits:
|
||||||
|
- train_sft
|
||||||
|
- test_sft
|
||||||
|
preprocessing_num_workers: 12
|
||||||
|
|
||||||
|
# SFT trainer config
|
||||||
|
bf16: true
|
||||||
|
do_eval: true
|
||||||
|
evaluation_strategy: steps
|
||||||
|
eval_steps: 200
|
||||||
|
gradient_accumulation_steps: 8
|
||||||
|
gradient_checkpointing: true
|
||||||
|
gradient_checkpointing_kwargs:
|
||||||
|
use_reentrant: False
|
||||||
|
hub_model_id: llama-3.2-3b-sft
|
||||||
|
hub_strategy: every_save
|
||||||
|
learning_rate: 2.0e-05
|
||||||
|
log_level: info
|
||||||
|
logging_steps: 5
|
||||||
|
logging_strategy: steps
|
||||||
|
lr_scheduler_type: cosine
|
||||||
|
max_seq_length: 2048
|
||||||
|
max_steps: -1
|
||||||
|
num_train_epochs: 1
|
||||||
|
output_dir: /workspace/checkpoints_new/llama-3-2-3b-sft
|
||||||
|
run_name: llama-3-2-3b-sft
|
||||||
|
overwrite_output_dir: true
|
||||||
|
per_device_eval_batch_size: 3
|
||||||
|
per_device_train_batch_size: 2
|
||||||
|
push_to_hub: false
|
||||||
|
remove_unused_columns: true
|
||||||
|
report_to:
|
||||||
|
- wandb
|
||||||
|
save_strategy: "steps"
|
||||||
|
save_steps: 1000000
|
||||||
|
save_total_limit: 1
|
||||||
|
seed: 42
|
||||||
|
warmup_ratio: 0.1
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Model arguments
|
||||||
|
model_name_or_path: NousResearch/Meta-Llama-3-8B
|
||||||
|
model_revision: main
|
||||||
|
torch_dtype: bfloat16
|
||||||
|
attn_implementation: flash_attention_2
|
||||||
|
|
||||||
|
# Data training arguments
|
||||||
|
chat_template: "{% set loop_messages = messages %}{% for message in loop_messages %}{% set content = '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' %}{% if loop.index0 == 0 %}{% set content = bos_token + content %}{% endif %}{{ content }}{% endfor %}{% if add_generation_prompt %}{{ '<|start_header_id|>assistant<|end_header_id|>\n\n' }}{% endif %}"
|
||||||
|
dataset_mixer:
|
||||||
|
wassname/ultrachat_200k_filtered: 1.0
|
||||||
|
dataset_splits:
|
||||||
|
- train_sft
|
||||||
|
- test_sft
|
||||||
|
preprocessing_num_workers: 12
|
||||||
|
|
||||||
|
# SFT trainer config
|
||||||
|
bf16: true
|
||||||
|
do_eval: true
|
||||||
|
evaluation_strategy: steps
|
||||||
|
eval_steps: 200
|
||||||
|
gradient_accumulation_steps: 4
|
||||||
|
gradient_checkpointing: true
|
||||||
|
gradient_checkpointing_kwargs:
|
||||||
|
use_reentrant: False
|
||||||
|
hub_model_id: zephyr-7b-sft-full
|
||||||
|
hub_strategy: every_save
|
||||||
|
learning_rate: 2.0e-05
|
||||||
|
log_level: info
|
||||||
|
logging_steps: 5
|
||||||
|
logging_strategy: steps
|
||||||
|
lr_scheduler_type: cosine
|
||||||
|
max_seq_length: 2048
|
||||||
|
max_steps: -1
|
||||||
|
num_train_epochs: 1
|
||||||
|
output_dir: /scratch/gpfs/DANQIC/ym0081/checkpoints_new/llama-3-8b-sft
|
||||||
|
run_name: llama-3-8b-sft
|
||||||
|
overwrite_output_dir: true
|
||||||
|
per_device_eval_batch_size: 8
|
||||||
|
per_device_train_batch_size: 8
|
||||||
|
push_to_hub: false
|
||||||
|
remove_unused_columns: true
|
||||||
|
report_to:
|
||||||
|
- wandb
|
||||||
|
save_strategy: "steps"
|
||||||
|
save_steps: 1000000
|
||||||
|
save_total_limit: 1
|
||||||
|
seed: 42
|
||||||
|
warmup_ratio: 0.1
|
||||||
Reference in New Issue
Block a user