Skip to content

[taskflow]fix taskflow pir bug#9871

Closed
Fantasy-02 wants to merge 16 commits into
PaddlePaddle:developfrom
Fantasy-02:dev_20250124_fix_taskflow_infer
Closed

[taskflow]fix taskflow pir bug#9871
Fantasy-02 wants to merge 16 commits into
PaddlePaddle:developfrom
Fantasy-02:dev_20250124_fix_taskflow_infer

Conversation

@Fantasy-02
Copy link
Copy Markdown
Contributor

Before submitting

  • Lint code. If there are lint issues, please format the code first.
# Install and register `pre-commit` in the project folder
pip install pre-commit && pre-commit install

# Process previous code files separately
pre-commit run --file XXXX.py
  • Add test cases into tests folder. If there are codecov issues, please add tests cases first.

PR types

Bug fixes

PR changes

Others

Description

fix bug when pir=True

@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented Feb 14, 2025

Thanks for your contribution!

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 14, 2025

CLA assistant check
All committers have signed the CLA.

for block in program.blocks:
for op in block.ops:
if op.type.count("quantize"):
if "quantize" in op.name():
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍


if "rocketqav2-en" in model or "ernie-search" in model:
self._model = ErnieCrossEncoder(self._task_path, num_classes=1, reinitialize=True)
self._model = ErnieCrossEncoder(self._task_path, num_classes=2, reinitialize=True)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这里修改了模型的num_classes,是否准确?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

他这里加载的模型参数,就是num_classes = 2的

self._construct_tokenizer()
self._check_predictor_type()
self._get_inference_model()
if self._static_mode:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这里是默认动态图了吗?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

probs = self.ernie.classifier(pooled_output)
return probs
cls_embedding = self.ernie.classifier(pooled_output)
probs = F.softmax(cls_embedding, axis=1)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这里为什么这样修改?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

参考了前面的match函数,然后也打印调试看过结果,发现二分类需要经过softmax,然后也用了案例去验证了一下正确性

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 14, 2025

Codecov Report

❌ Patch coverage is 14.47368% with 65 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.42%. Comparing base (8e4ff07) to head (dab5b6e).
⚠️ Report is 481 commits behind head on develop.

Files with missing lines Patch % Lines
...addlenlp/taskflow/zero_shot_text_classification.py 0.00% 24 Missing ⚠️
paddlenlp/taskflow/task.py 7.14% 13 Missing ⚠️
...addlenlp/taskflow/multimodal_feature_extraction.py 11.11% 8 Missing ⚠️
paddlenlp/generation/utils.py 0.00% 6 Missing ⚠️
paddlenlp/server/predictor.py 16.66% 5 Missing ⚠️
paddlenlp/utils/env.py 60.00% 4 Missing ⚠️
paddlenlp/transformers/semantic_search/modeling.py 0.00% 3 Missing ⚠️
...dlenlp/experimental/autonlp/text_classification.py 0.00% 1 Missing ⚠️
paddlenlp/taskflow/text_similarity.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #9871   +/-   ##
========================================
  Coverage    51.41%   51.42%           
========================================
  Files          745      745           
  Lines       118351   118364   +13     
========================================
+ Hits         60856    60863    +7     
- Misses       57495    57501    +6     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ZHUI ZHUI mentioned this pull request Feb 17, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants