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

【Qwen2-VL Inference】add qwen2-vl high performance inference #9575

Merged
merged 19 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,14 @@ def forward(
residual_input = src
for i in range(self.num_layers):
qkv_out, residual_input = self.compute_qkv(src, residual_input, i)

import paddle

to_file = "/root/tmp/rotary.pdparams"
state_dict = paddle.load(to_file, return_numpy=False)
rotary_embs = state_dict["inputs_embeds"].cast("float32")
# print(rotary_embs.shape)

out_linear_out = self.compute_attn(
time_step,
qkv_out,
Expand Down
13 changes: 7 additions & 6 deletions paddlenlp/experimental/transformers/generation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,12 +743,13 @@ def _post_process_(
model_kwargs["next_tokens"],
)

save_output(
next_tokens,
model_kwargs["not_need_stop"],
model_kwargs.get("accept_num", None), # only initialized in speculative decoding
self.config.tensor_parallel_rank,
)
# save_output(
# next_tokens,
# model_kwargs["not_need_stop"],
# model_kwargs.get("accept_num", None), # only initialized in speculative decoding
# self.config.tensor_parallel_rank,
# )

return next_tokens
else:
from paddlenlp_ops import (
Expand Down
Loading