Skip to content

Commit

Permalink
fix sft gradient (PaddlePaddle#494)
Browse files Browse the repository at this point in the history
Co-authored-by: LokeZhou <[email protected]>
  • Loading branch information
pkhk-1 and LokeZhou authored Apr 1, 2024
1 parent b4e81b6 commit 53cb640
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions paddlemix/config/llava/pretrain.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"model_name_or_path": "paddlemix/llava/vicuna-13b-v1.5",
"freeze_include": ["*llama*", "*lm_head*"],
"freeze_exclude": ["*llama.mm_projector*"],
"dataset": {
"train":[{"name": "chatml_dataset", "data_files": "train.json"}],
"eval":[{"name": "chatml_dataset", "data_files": "val.json"}]
Expand Down
2 changes: 1 addition & 1 deletion paddlemix/examples/llava/run_predict_multiround.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def main(args):
with paddle.no_grad():
output_ids = model.generate(
input_ids=data_dict["input_ids"],
images=data_dict["images"],
images=paddle.cast(data_dict["images"],compute_dtype),
image_sizes=[image_size],
decode_strategy="sampling" if args.temperature > 0 else "greedy_search",
temperature=args.temperature,
Expand Down
3 changes: 0 additions & 3 deletions paddlemix/trainer/llava_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ def create_optimizer(self, lr_scheduler=None):

opt_model = self.model

# case pretrain
for p in self.model.parameters():
p.stop_gradient = True
for p in self.model.llama.mm_projector.parameters():
p.stop_gradient = not True

Expand Down

0 comments on commit 53cb640

Please sign in to comment.