-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[utc] fix loading local model in taskflow #4505
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7d6d008
[utc] fix loading local model in taskflow
LemonNoel 7134f4c
[utc] fix task_path in deployment
LemonNoel c4fff60
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP i…
LemonNoel afbaaa7
[utc] add resource_urls for default model
LemonNoel 7f51676
[utc] update taskflow
LemonNoel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LemonNoel 改成from_pretrained("{local_path}")的形式后,需要定义resource_files_names和resource_files_urls并在__init__ 中增加 self._check_task_files(),可以参考这里https://github.com/PaddlePaddle/PaddleNLP/blob/develop/paddlenlp/taskflow/information_extraction.py#L115
关于例如from_pretrained("utc_large")调用后模型不能再通过from_pretrained("{local_path}")方式加载的问题也请 @wj-Mcat 帮忙看下,我们后续看看能不能解决一下这里的gap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果是改成这样,没必要if了,直接一行
model_instance = UTC.from_pretrained(self._task_path, from_hf_hub=self.from_hf_hub)
就行了。@linjieccc UTC taskflow有做from_pretrained以外的文件下载吗?像这种已经整合pretrained config的模型和taskflow, 建议下载功能全部由from_pretrained承载,不要再做分开的下载逻辑了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sijunhe 嗯嗯,这里确实改成下载功能全部通过from_pretrained承载好些,也可以避免模型文件重复下载的情况,后续会针对这块处理进行统一升级
关于Taskflow内非transformers类的模型,例如像GRU-CRF,目前模型是放在$PPNLP_HOME/.taskflow/{task_name}/{model_name},是否这部分模型后续也统一放在$PPNLP_HOME/.paddlenlp/models管理,模型加载的代码在Taskflow中实现