Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sft flash mask #8664

Merged
merged 11 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update
  • Loading branch information
wtmlon committed Jun 26, 2024
commit 21b790acf171c05e7801e0e8c217b9fa537a3a9f
4 changes: 4 additions & 0 deletions llm/alignment/dpo/run_dpo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import os
import sys
import time
import inspect
from functools import partial

import paddle
Expand Down Expand Up @@ -124,6 +125,9 @@ def main():
ref_model = AutoModelForCausalLM.from_config(ref_config)
model.set_state_dict(ref_model.state_dict())

if model_args.use_attn_mask_startend_row_indices and "attn_mask_startend_row_indices" not in inspect.signature(model.forward).parameters:
raise NotImplementedError(f"{model.__class__} not support flash mask.")

if model_args.tokenizer_name_or_path is not None:
tokenizer = AutoTokenizer.from_pretrained(model_args.tokenizer_name_or_path)
else:
Expand Down
4 changes: 4 additions & 0 deletions llm/run_finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import json
import os
import sys
import inspect
from functools import partial

import paddle
Expand Down Expand Up @@ -160,6 +161,9 @@ def main():
# NOTE(gongenlei): new add autotuner_benchmark
model = model_class.from_config(model_config, dtype=dtype)

if model_args.use_attn_mask_startend_row_indices and "attn_mask_startend_row_indices" not in inspect.signature(model.forward).parameters:
wtmlon marked this conversation as resolved.
Show resolved Hide resolved
raise NotImplementedError(f"{model.__class__} not support flash mask.")

if training_args.do_train and model_args.neftune:
# Inspired by https://github.com/neelsjain/NEFTune
if hasattr(model, "get_input_embeddings"):
Expand Down
Loading