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

Update predict_generation.py #6491

Merged
merged 1 commit into from
Jul 25, 2023
Merged
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
6 changes: 3 additions & 3 deletions llm/chatglm/predict_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
chatglm_pad_attention_mask,
chatglm_postprocess_past_key_value,
)
from paddlenlp.transformers import ChatGLMConfig, ChatGLMForCausalLM, ChatGLMTokenizer
from paddlenlp.transformers import ChatGLMConfig, AutoTokenizer, AutoModelForCausalLM


def parse_arguments():
Expand Down Expand Up @@ -62,7 +62,7 @@ def __init__(self, args=None, tokenizer=None, model=None, **kwargs):
self.src_length = kwargs["src_length"]
self.tgt_length = kwargs["tgt_length"]
else:
self.tokenizer = ChatGLMTokenizer.from_pretrained(args.model_name_or_path)
self.tokenizer = AutoTokenizer.from_pretrained(args.model_name_or_path)
self.batch_size = args.batch_size
self.args = args
self.src_length = self.args.src_length
Expand Down Expand Up @@ -92,7 +92,7 @@ def __init__(self, args=None, tokenizer=None, model=None, **kwargs):
config = ChatGLMConfig.from_pretrained(args.model_name_or_path)
dtype = config.dtype if config.dtype is not None else config.paddle_dtype

self.model = ChatGLMForCausalLM.from_pretrained(
self.model = AutoModelForCausalLM.from_pretrained(
args.model_name_or_path,
tensor_parallel_degree=tensor_parallel_degree,
tensor_parallel_rank=tensor_parallel_rank,
Expand Down