Skip to content

Commit

Permalink
fix issue of pipeline and add lazy_init
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff41404 committed Nov 29, 2024
1 parent 67c014e commit 54b816d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
5 changes: 3 additions & 2 deletions llm/auto_parallel/qwen/run_pretrain_3D_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,9 @@ def main():
if training_args.bf16:
dtype = "bfloat16"

model = model_class.from_config(config, dtype=dtype)
criterion = criterion_class(config)
with paddle.LazyGuard():
model = model_class.from_config(config, dtype=dtype)
criterion = criterion_class(config)

# load_model(model)
# shard_model(model)
Expand Down
28 changes: 14 additions & 14 deletions paddlenlp/transformers/qwen/modeling_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,24 +662,24 @@ def forward(
outputs = self.recompute_training(
block,
hidden_states,
layer_past=layer_past,
attention_mask=attention_mask,
position_ids=position_ids,
encoder_hidden_states=encoder_hidden_states,
encoder_attention_mask=encoder_attention_mask,
use_cache=use_cache,
output_attentions=output_attentions,
layer_past,
attention_mask,
position_ids,
encoder_hidden_states,
encoder_attention_mask,
use_cache,
output_attentions,
)
else:
outputs = block(
hidden_states,
layer_past=layer_past,
attention_mask=attention_mask,
position_ids=position_ids,
encoder_hidden_states=encoder_hidden_states,
encoder_attention_mask=encoder_attention_mask,
use_cache=use_cache,
output_attentions=output_attentions,
layer_past,
attention_mask,
position_ids,
encoder_hidden_states,
encoder_attention_mask,
use_cache,
output_attentions,
)

if type(outputs) is tuple:
Expand Down

0 comments on commit 54b816d

Please sign in to comment.