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

[Prediction] Update LLM prediction. #8778

Merged
merged 8 commits into from
Jul 25, 2024

Conversation

DesmonDay
Copy link
Contributor

PR types

Function optimization

PR changes

Others

Description

Update LLM prediction, support safetensors model download and loading.

Copy link

paddle-bot bot commented Jul 18, 2024

Thanks for your contribution!

Copy link

codecov bot commented Jul 18, 2024

Codecov Report

Attention: Patch coverage is 3.14961% with 123 lines in your changes missing coverage. Please review.

Project coverage is 55.53%. Comparing base (7c18d9d) to head (ebc553d).
Report is 225 commits behind head on develop.

Files with missing lines Patch % Lines
paddlenlp/transformers/model_utils.py 4.93% 77 Missing ⚠️
paddlenlp/experimental/transformers/utils.py 0.00% 31 Missing ⚠️
...enlp/experimental/transformers/chatglm/modeling.py 0.00% 6 Missing ⚠️
...ddlenlp/experimental/transformers/qwen/modeling.py 0.00% 3 Missing ⚠️
...addlenlp/experimental/transformers/gpt/modeling.py 0.00% 2 Missing ⚠️
...dlenlp/experimental/transformers/llama/modeling.py 0.00% 2 Missing ⚠️
...addlenlp/experimental/transformers/opt/modeling.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8778      +/-   ##
===========================================
+ Coverage    55.03%   55.53%   +0.50%     
===========================================
  Files          627      631       +4     
  Lines        98921    98466     -455     
===========================================
+ Hits         54440    54685     +245     
+ Misses       44481    43781     -700     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

# TODO: Support safetensors loading.
kwargs["use_safetensors"] = False
return super().from_pretrained(pretrained_model_name_or_path, *args, **kwargs)
config = kwargs.pop("config", None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些地方没法统一到一处吗?

ZHUI
ZHUI previously approved these changes Jul 23, 2024
from safetensors.numpy import load_file as safe_load_file


def load_sharded_checkpoint(folder, variant=None, return_numpy=False):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些类似的函数可以放入主库

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是可以直接放到paddlenlp/transformers/model_utils.py里作为类函数?所有实现的类都可以直接调用

from safetensors.numpy import save_file as safe_save_file

if sys.platform.startswith("win"):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么删除?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

搞错了,已修改。

Copy link
Collaborator

@wawltor wawltor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wawltor wawltor merged commit 77f6e98 into PaddlePaddle:develop Jul 25, 2024
9 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants