【inference】support load or save Llama2-7b in three patterns#8712
Merged
Conversation
|
Thanks for your contribution! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #8712 +/- ##
===========================================
- Coverage 55.74% 55.73% -0.01%
===========================================
Files 623 623
Lines 97456 97459 +3
===========================================
Hits 54323 54323
- Misses 43133 43136 +3 ☔ View full report in Codecov by Sentry. |
yuanlehome
reviewed
Jul 4, 2024
Comment on lines
+360
to
+364
| inference_config.disable_glog_info() | ||
| # inference_config.disable_glog_info() |
| inference_config.disable_glog_info() | ||
| # inference_config.disable_glog_info() | ||
| inference_config.enable_new_executor() | ||
|
|
Comment on lines
+371
to
+372
| # if use optimized_model to inference | ||
| # inference_config.use_optimized_model(True) |
| def _preprocess(self, input_text: str | list[str]): | ||
| inputs = super()._preprocess(input_text) | ||
| inputs["max_new_tokens"] = np.array(self.config.max_length, dtype="int64") | ||
|
|
yuanlehome
approved these changes
Jul 4, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR types
New features
PR changes
Others
Description
补充:
python ./predict/export_model.py --model_name_or_path meta-llama/Llama-2-7b-chat --output_path ./inference --dtype float16FLAGS_enable_pir_api=1 python ./predict/export_model.py --model_name_or_path meta-llama/Llama-2-7b-chat --output_path ./inference --dtype float16支持三种模式跑
python ./predict/predictor.py --model_name_or_path ./llama2-7b --dtype float16 --mode staticFLAGS_enable_pir_in_executor=1 python ./predict/predictor.py --model_name_or_path ./llama2-7b --dtype float16 --mode staticFLAGS_enable_pir_api=1 python ./predict/predictor.py --model_name_or_path ./inference --dtype float16 --mode static如需测试保存优化后的模型再推理,设置inference_config.use_optimized_model(True),第一次执行会先保存优化后的模型,第二次执行,会直接加载优化后的模型进行推理