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

[LLM] add Qwen-7B-Chat to PaddleNLP unit test #7823

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions llm/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,7 @@ def create_predictor(

tensor_parallel_rank, tensor_parallel_degree = init_dist_env()
if not predictor_args.inference_model:
tokenizer.padding_side = "left"
if predictor_args.mode == "dynamic":
if model_args.model_type == "gpt-3":
sys.path.append("./gpt-3")
Expand Down
4 changes: 1 addition & 3 deletions paddlenlp/generation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,10 +1059,8 @@ def greedy_search(

# pre-process distribution
next_token_logits = self.adjust_logits_during_generation(next_token_logits)
next_tokens_scores = logits_processors(input_ids, next_token_logits)
probs = logits_processors(input_ids, next_token_logits)
# greedy
probs = F.softmax(next_tokens_scores)
probs = paddle.log(probs)
next_tokens = paddle.argmax(probs, axis=-1).unsqueeze(-1)
next_scores = paddle.index_sample(probs, next_tokens)

Expand Down
1 change: 1 addition & 0 deletions paddlenlp/transformers/qwen/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def __init__(
self,
vocab_file,
errors="replace",
padding_side="left",
**kwargs,
):
super().__init__(**kwargs)
Expand Down
2 changes: 2 additions & 0 deletions tests/llm/test_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
ChatGLMForCausalLM,
ChatGLMv2ForCausalLM,
LlamaForCausalLM,
QWenForCausalLM,
)
from paddlenlp.utils.downloader import (
COMMUNITY_MODEL_PREFIX,
Expand All @@ -43,6 +44,7 @@
["__internal_testing__/tiny-fused-bloom", BloomForCausalLM],
["__internal_testing__/tiny-fused-chatglm", ChatGLMForCausalLM],
["__internal_testing__/tiny-fused-chatglm2", ChatGLMv2ForCausalLM],
["__internal_testing__/tiny-fused-qwen-inference5.2", QWenForCausalLM],
],
)
class PredictorTest(LLMTest, unittest.TestCase):
Expand Down