mirror of
https://github.com/wassname/alignment-handbook.git
synced 2026-07-20 12:10:44 +08:00
🪁 (#129)
* Add Gemma 7B recipe * Use Gemma template * Make it work for dolly lol * Enable cahce * Clean up * DPO to the max * DPO, DPO, DPO * Add openhermes * Add custom configs * Add kwargs * Fix config * Bump deps * Move old recipes * Add doc * Add norte * Renable cache * Nuke * Clean * Apply suggestions from code review Co-authored-by: Alvaro Bartolome <alvaro@argilla.io> * Fix isort * Update README.md * Update config_full.yaml --------- Co-authored-by: Alvaro Bartolome <alvaro@argilla.io> Co-authored-by: Philipp Schmid <32632186+philschmid@users.noreply.github.com>
This commit is contained in:
co-authored by
Alvaro Bartolome
Philipp Schmid
parent
d17fd7cd3b
commit
ff618a4d13
@@ -136,6 +136,14 @@ class ModelArguments:
|
||||
"choices": ["auto", "bfloat16", "float16", "float32"],
|
||||
},
|
||||
)
|
||||
tokenizer_name_or_path: Optional[str] = field(
|
||||
default=None,
|
||||
metadata={
|
||||
"help": (
|
||||
"The path to the tokenizer. Useful if you want to use a different tokenizer to the one stored in `model_name_or_path`."
|
||||
)
|
||||
},
|
||||
)
|
||||
trust_remote_code: bool = field(default=False, metadata={"help": "Trust remote code when loading a model."})
|
||||
use_flash_attention_2: bool = field(
|
||||
default=False,
|
||||
@@ -220,6 +228,9 @@ class SFTConfig(transformers.TrainingArguments):
|
||||
Arguments related to the training process itself. For all parameters, see: https://huggingface.co/docs/transformers/v4.26.1/en/main_classes/trainer#transformers.TrainingArguments
|
||||
"""
|
||||
|
||||
dataset_kwargs: Optional[Dict[str, Any]] = field(
|
||||
default=None, metadata={"help": "Dataset kwargs for the SFTTrainer"}
|
||||
)
|
||||
max_seq_length: Optional[int] = field(
|
||||
default=None,
|
||||
metadata={"help": ("Used by TRL for reward model training, which tries to read this parameter in init.")},
|
||||
|
||||
@@ -34,7 +34,7 @@ def maybe_insert_system_message(messages, tokenizer):
|
||||
chat_template = tokenizer.default_chat_template
|
||||
|
||||
# confirm the jinja template refers to a system message before inserting
|
||||
if "system" in chat_template:
|
||||
if "system" in chat_template or "<|im_start|>" in chat_template:
|
||||
messages.insert(0, {"role": "system", "content": ""})
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,9 @@ def get_quantization_config(model_args: ModelArguments) -> BitsAndBytesConfig |
|
||||
def get_tokenizer(model_args: ModelArguments, data_args: DataArguments) -> PreTrainedTokenizer:
|
||||
"""Get the tokenizer for the model."""
|
||||
tokenizer = AutoTokenizer.from_pretrained(
|
||||
model_args.model_name_or_path,
|
||||
model_args.model_name_or_path
|
||||
if model_args.tokenizer_name_or_path is None
|
||||
else model_args.tokenizer_name_or_path,
|
||||
revision=model_args.model_revision,
|
||||
)
|
||||
if tokenizer.pad_token_id is None:
|
||||
|
||||
Reference in New Issue
Block a user