-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Question]: 使用Taskflow进行NER时出错 #9413
Comments
可以尝试删除再试试 C:\Users\lenovo.paddlenlp\taskflow\wordtag\static\ |
您是说删除static这个文件夹,再重新运行ner = Taskflow("ner")吗 |
可以尝试把paddle版本切换到2.5.2版本,同时删除 ,C:\Users\lenovo.paddlenlp\taskflow\wordtag\static\ |
您是说把paddlenlp的版本降到2.5.2吗,我试一下 |
是的 |
确实没有出现之前的报错了,但是出现了另一个错误 File D:\anaconda3\Lib\site-packages\paddlenlp\taskflow\taskflow.py:809, in Taskflow.init(self, task, model, mode, device_id, from_hf_hub, **kwargs) File D:\anaconda3\Lib\site-packages\paddlenlp\taskflow\named_entity_recognition.py:123, in NERWordTagTask.init(self, model, task, entity_only, **kwargs) File D:\anaconda3\Lib\site-packages\paddlenlp\taskflow\knowledge_mining.py:235, in WordTagTask.init(self, model, task, tag_path, term_schema_path, term_data_path, user_dict, linking, spo_config_path, with_ie, **kwargs) File D:\anaconda3\Lib\site-packages\paddlenlp\taskflow\task.py:343, in _get_inference_model(self) File D:\anaconda3\Lib\site-packages\paddlenlp\taskflow\task.py:389, in _convert_dygraph_to_static(self) File D:\anaconda3\Lib\site-packages\decorator.py:232, in decorate..fun(*args, **kw) File D:\anaconda3\Lib\site-packages\paddle\base\wrapped_decorator.py:40, in wrap_decorator..impl(func, *args, **kwargs) File D:\anaconda3\Lib\site-packages\paddle\jit\api.py:895, in _run_save_pre_hooks..wrapper(layer, path, input_spec, **configs) File D:\anaconda3\Lib\site-packages\decorator.py:232, in decorate..fun(*args, **kw) File D:\anaconda3\Lib\site-packages\paddle\base\wrapped_decorator.py:40, in wrap_decorator..impl(func, *args, **kwargs) File D:\anaconda3\Lib\site-packages\paddle\base\dygraph\base.py:101, in switch_to_static_graph..impl(*args, **kwargs) File D:\anaconda3\Lib\site-packages\paddle\jit\api.py:1209, in save(layer, path, input_spec, **configs) File D:\anaconda3\Lib\site-packages\paddle\jit\dy2static\program_translator.py:1026, in ASTStaticFunction.concrete_program_specify_input_spec(self, input_spec, with_hook, is_prim_infer) File D:\anaconda3\Lib\site-packages\paddle\jit\dy2static\program_translator.py:914, in ASTStaticFunction.get_concrete_program(self, *args, **kwargs) File D:\anaconda3\Lib\site-packages\paddle\jit\dy2static\program_translator.py:1665, in ProgramCache.getitem(self, item) File D:\anaconda3\Lib\site-packages\paddle\jit\dy2static\program_translator.py:1603, in ProgramCache._build_once(self, cache_key) File D:\anaconda3\Lib\site-packages\decorator.py:232, in decorate..fun(*args, **kw) File D:\anaconda3\Lib\site-packages\paddle\base\wrapped_decorator.py:40, in wrap_decorator..impl(func, *args, **kwargs) File D:\anaconda3\Lib\site-packages\paddle\base\dygraph\base.py:101, in switch_to_static_graph..impl(*args, **kwargs) File D:\anaconda3\Lib\site-packages\paddle\jit\dy2static\program_translator.py:1276, in ConcreteProgram.pir_from_func_spec(func_spec, input_spec, input_kwargs_spec, class_instance, **kwargs) File D:\anaconda3\Lib\site-packages\paddle\jit\dy2static\error.py:454, in ErrorData.raise_new_exception(self) TypeError: In transformed code:
` |
请问这个还是版本问题吗 |
当我设置paddlepaddle==2.6.1,paddlenlp==2.6.1时,就没有再报错了,可以正常使用了 |
兄弟,真心感谢你,我被这个问题困扰很久了,看了你的答复换了paddlenlp的版本也解决了。
|
客气,有帮助就好 |
请提出你的问题
环境为windows10家庭版,paddle版本为3.0-beta的cpu版本
[2024-11-12 16:08:27,954] [ INFO] - Downloading config.json from https://bj.bcebos.com/paddlenlp/taskflow/knowledge_mining/wordtag_v1.1/config.json
[2024-11-12 16:08:28,355] [ INFO] - Downloading tags.txt from https://bj.bcebos.com/paddlenlp/taskflow/knowledge_mining/wordtag_v1.1/tags.txt
[2024-11-12 16:08:28,561] [ INFO] - Downloading vocab.txt from https://bj.bcebos.com/paddlenlp/taskflow/knowledge_mining/wordtag/vocab.txt
[2024-11-12 16:08:28,980] [ INFO] - Downloading special_tokens_map.json from https://bj.bcebos.com/paddlenlp/taskflow/knowledge_mining/wordtag/special_tokens_map.json
[2024-11-12 16:08:29,206] [ INFO] - Downloading tokenizer_config.json from https://bj.bcebos.com/paddlenlp/taskflow/knowledge_mining/wordtag/tokenizer_config.json
[2024-11-12 16:08:29,421] [ INFO] - Loading configuration file C:\Users\lenovo.paddlenlp\taskflow\wordtag\config.json
[2024-11-12 16:08:29,424] [ INFO] - Loading weights file C:\Users\lenovo.paddlenlp\taskflow\wordtag\model_state.pdparams
[2024-11-12 16:08:29,665] [ INFO] - Loaded weights file from disk, setting weights to model.
[2024-11-12 16:08:36,820] [ WARNING] - Some weights of the model checkpoint at C:\Users\lenovo.paddlenlp\taskflow\wordtag were not used when initializing ErnieCtmWordtagModel: ['sent_classifier.bias', 'sent_classifier.weight']
This IS expected if you are initializing ErnieCtmWordtagModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
This IS NOT expected if you are initializing ErnieCtmWordtagModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
[2024-11-12 16:08:36,821] [ WARNING] - Some weights of ErnieCtmWordtagModel were not initialized from the model checkpoint at C:\Users\lenovo.paddlenlp\taskflow\wordtag and are newly initialized: ['viterbi_decoder.transitions', 'crf_loss.crf.transitions']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
[2024-11-12 16:08:36,847] [ INFO] - Converting to the inference model cost a little time.
D:\anaconda3\Lib\site-packages\paddle\jit\dy2static\program_translator.py:747: UserWarning: full_graph=False don't support input_spec arguments. It will not produce any effect.
You can set full_graph=True, then you can assign input spec.
warnings.warn(
[2024-11-12 16:08:41,319] [ INFO] - The inference model save in the path:C:\Users\lenovo.paddlenlp\taskflow\wordtag\static\inference
RuntimeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 ner = Taskflow("ner")
File D:\anaconda3\Lib\site-packages\paddlenlp\taskflow\taskflow.py:809, in Taskflow.init(self, task, model, mode, device_id, from_hf_hub, **kwargs)
807 self.kwargs = kwargs
808 task_class = TASKS[self.task][tag][self.model]["task_class"]
--> 809 self.task_instance = task_class(
810 model=self.model, task=self.task, priority_path=self.priority_path, from_hf_hub=from_hf_hub, **self.kwargs
811 )
812 task_list = TASKS.keys()
813 Taskflow.task_list = task_list
File D:\anaconda3\Lib\site-packages\paddlenlp\taskflow\named_entity_recognition.py:123, in NERWordTagTask.init(self, model, task, entity_only, **kwargs)
122 def init(self, model, task, entity_only=False, **kwargs):
--> 123 super().init(model="wordtag", task=task, **kwargs)
124 self.entity_only = entity_only
125 if self._user_dict:
File D:\anaconda3\Lib\site-packages\paddlenlp\taskflow\knowledge_mining.py:235, in WordTagTask.init(self, model, task, tag_path, term_schema_path, term_data_path, user_dict, linking, spo_config_path, with_ie, **kwargs)
233 self._usage = usage
234 self._summary_num = 2
--> 235 self._get_inference_model()
237 if self._user_dict:
238 self._custom = Customization()
File D:\anaconda3\Lib\site-packages\paddlenlp\taskflow\task.py:371, in Task._get_inference_model(self)
369 self._static_params_file = self._static_fp16_params_file
370 if self._predictor_type == "paddle-inference":
--> 371 self._config = paddle.inference.Config(self._static_model_file, self._static_params_file)
372 self._prepare_static_mode()
373 else:
RuntimeError: (NotFound) Cannot open file C:\Users\lenovo.paddlenlp\taskflow\wordtag\static\inference.pdmodel, please confirm whether the file is normal.
[Hint: Expected paddle::inference::IsFileExists(prog_file_) == true, but received paddle::inference::IsFileExists(prog_file_):0 != true:1.] (at ..\paddle\fluid\inference\api\analysis_config.cc:111)`
有查到和这个问题类似:#3242
但是我的目录中并没有中文,用户名是lenovo,为什么也会出现这种情况?
The text was updated successfully, but these errors were encountered: