PaddlePaddle / PaddleNLP

👑 Easy-to-use and powerful NLP and LLM library with 🤗 Awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications, including 🗂Text Classification, 🔍 Neural Search, ❓ Question Answering, ℹ️ Information Extraction, 📄 Document Intelligence, 💌 Sentiment Analysis etc.
https://paddlenlp.readthedocs.io
Apache License 2.0
12.11k stars 2.94k forks source link

在centos安装paddlepaddle==2.6.1/paddlenlp==2.6.1/paddleocr==2.7.3进行UIE提取报错,问题如下面链接,请帮忙解决,多谢 #8602

Closed AllenMeng2009 closed 4 months ago

AllenMeng2009 commented 5 months ago

请提出你的问题

https://github.com/PaddlePaddle/Paddle/issues/64975 在centos上安装paddle==2.6.1版本出现Illegal instruction (core dumped)错误,用dmesg -T查看有下面错误,是什么原因?

AllenMeng2009 commented 5 months ago

所述问题如此链接,https://github.com/PaddlePaddle/Paddle/issues/64975

AllenMeng2009 commented 5 months ago

当前环境python版本为3.9.10,后来我把paddlepaddle版本降为2.5.2,其他库版本如下: [root@iZbp18xzwld4sbol3iq0huZ recommend_food]# pip3.9 list Package Version


absl-py 2.1.0 aiohttp 3.9.5 aiosignal 1.3.1 aistudio-sdk 0.2.4 annotated-types 0.7.0 anyio 4.4.0 astor 0.8.1 async-timeout 4.0.3 attrdict 2.0.1 attrs 23.2.0 Babel 2.15.0 bce-python-sdk 0.9.14 beautifulsoup4 4.12.3 blinker 1.8.2 cachetools 5.3.3 certifi 2024.6.2 charset-normalizer 3.3.2 click 8.1.7 colorama 0.4.6 coloredlogs 15.0.1 colorlog 6.8.2 contourpy 1.2.1 cssselect 1.2.0 cssutils 2.11.1 cycler 0.12.1 Cython 3.0.10 datasets 2.19.2 decorator 5.1.1 dill 0.3.4 dnspython 2.6.1 email_validator 2.1.1 erniebot 0.5.5 et-xmlfile 1.1.0 exceptiongroup 1.2.1 fastapi 0.111.0 fastapi-cli 0.0.4 filelock 3.14.0 fire 0.6.0 Flask 3.0.3 Flask-Babel 2.0.0 flatbuffers 24.3.25 fonttools 4.53.0 frozenlist 1.4.1 fsspec 2024.3.1 future 1.0.0 h11 0.14.0 h5py 3.11.0 httpcore 1.0.5 httptools 0.6.1 httpx 0.27.0 huggingface-hub 0.23.3 humanfriendly 10.0 idna 3.7 imageio 2.34.1 imgaug 0.4.0 importlib_metadata 7.1.0 importlib_resources 6.4.0 itsdangerous 2.2.0 jieba 0.42.1 Jinja2 3.1.4 joblib 1.4.2 jsonschema 4.22.0 jsonschema-specifications 2023.12.1 keras 3.3.3 kiwisolver 1.4.5 lanms_neo 1.0.2 lazy_loader 0.4 lmdb 1.4.1 lxml 5.2.2 markdown-it-py 3.0.0 MarkupSafe 2.1.5 matplotlib 3.9.0 mdurl 0.1.2 ml-dtypes 0.4.0 more-itertools 10.2.0 mpmath 1.3.0 multidict 6.0.5 multiprocess 0.70.12.2 mysql-connector-python 8.4.0 namex 0.0.8 networkx 3.2.1 numpy 1.26.4 nvidia-cublas-cu12 12.1.3.1 nvidia-cuda-cupti-cu12 12.1.105 nvidia-cuda-nvrtc-cu12 12.1.105 nvidia-cuda-runtime-cu12 12.1.105 nvidia-cudnn-cu12 8.9.2.26 nvidia-cufft-cu12 11.0.2.54 nvidia-curand-cu12 10.3.2.106 nvidia-cusolver-cu12 11.4.5.107 nvidia-cusparse-cu12 12.1.0.106 nvidia-nccl-cu12 2.19.3 nvidia-nvjitlink-cu12 12.5.40 nvidia-nvtx-cu12 12.1.105 onnx 1.16.0 onnxruntime 1.17.3 opencv-contrib-python 4.6.0.66 opencv-python 4.6.0.66 opencv-python-headless 4.9.0.80 openpyxl 3.0.10 opt-einsum 3.3.0 optree 0.11.0 orjson 3.10.3 packaging 24.0 paddle-bfloat 0.1.7 paddle2onnx 0.8.1 paddlefsl 1.1.0 paddlenlp 2.6.1 paddleocr 2.7.3 paddlepaddle 2.5.2 pandas 2.1.4 pdf2docx 0.5.8 pillow 10.2.0 pip 24.0 Polygon3 3.0.9.1 premailer 3.10.0 prettytable 3.10.0 proto-plus 1.23.0 protobuf 3.20.2 psutil 5.9.8 pyarrow 16.1.0 pyarrow-hotfix 0.6 pybind11 2.12.0 pyclipper 1.3.0.post5 pycryptodome 3.20.0 pydantic 2.7.3 pydantic_core 2.18.4 Pygments 2.18.0 PyMuPDF 1.19.0 PyMuPDFb 1.24.3 pyparsing 3.1.2 python-dateutil 2.9.0.post0 python-docx 1.1.2 python-dotenv 1.0.1 python-multipart 0.0.9 pytz 2024.1 PyYAML 6.0.1 rapidfuzz 3.9.3 rarfile 4.2 referencing 0.35.1 regex 2024.5.15 requests 2.32.3 rich 13.7.1 rpds-py 0.18.1 safetensors 0.4.3 scikit-image 0.22.0 scikit-learn 1.2.2 scipy 1.13.1 sentencepiece 0.2.0 seqeval 0.0.10 setuptools 58.1.0 shapely 2.0.4 shellingham 1.5.4 six 1.16.0 sklearn 0.0 sniffio 1.3.1 soupsieve 2.5 starlette 0.37.2 sympy 1.12.1 tenacity 8.3.0 termcolor 2.4.0 threadpoolctl 3.5.0 tifffile 2024.5.22 tool-helpers 0.1.1 torch 2.2.2 torchvision 0.17.2 tqdm 4.66.4 triton 2.2.0 typer 0.12.3 typing_extensions 4.12.2 tzdata 2024.1 ujson 5.10.0 urllib3 1.26.18 uvicorn 0.30.1 uvloop 0.19.0 visualdl 2.4.2 watchfiles 0.22.0 wcwidth 0.2.13 websockets 12.0 Werkzeug 3.0.3 xxhash 3.4.1 yarl 1.9.4 zipp 3.19.2 有以下错误: [2024-06-13 18:10:31,702] [ INFO] - We are using <class 'paddlenlp.transformers.ernie_layout.tokenizer.ErnieLayoutTokenizer'> to load '/root/.paddlenlp/taskflow/information_extraction/uie-x-base'. Traceback (most recent call last): File "/opt/springboot/sry/suanfa/recommend_food/medical_report_ocr.py", line 20, in k = ie({"doc": "./image/20242.jpg"}) File "/usr/local/lib/python3.9/site-packages/paddlenlp/taskflow/taskflow.py", line 817, in call results = self.task_instance(inputs, kwargs) File "/usr/local/lib/python3.9/site-packages/paddlenlp/taskflow/task.py", line 527, in call outputs = self._run_model(inputs, kwargs) File "/usr/local/lib/python3.9/site-packages/paddlenlp/taskflow/information_extraction.py", line 1068, in _run_model results = self._multi_stage_predict(_inputs) File "/usr/local/lib/python3.9/site-packages/paddlenlp/taskflow/information_extraction.py", line 1166, in _multi_stage_predict result_list = self._single_stage_predict(examples) File "/usr/local/lib/python3.9/site-packages/paddlenlp/taskflow/information_extraction.py", line 979, in _single_stage_predict self.predictor.run() ValueError: In user code:

File "/opt/springboot/sry/suanfa/recommend_food/medical_report_ocr.py", line 18, in <module>
  ie = Taskflow("information_extraction", schema=schema, model="uie-x-base") #, batch_size=512, layout_analysis=True
File "/usr/local/lib/python3.9/site-packages/paddlenlp/taskflow/taskflow.py", line 804, in __init__
  self.task_instance = task_class(
File "/usr/local/lib/python3.9/site-packages/paddlenlp/taskflow/information_extraction.py", line 536, in __init__
  self._get_inference_model()
File "/usr/local/lib/python3.9/site-packages/paddlenlp/taskflow/task.py", line 343, in _get_inference_model
  self._convert_dygraph_to_static()
File "/usr/local/lib/python3.9/site-packages/paddlenlp/taskflow/task.py", line 389, in _convert_dygraph_to_static
  paddle.jit.save(static_model, self.inference_model_path)
File "/usr/local/lib/python3.9/site-packages/decorator.py", line 232, in fun
  return caller(func, *(extras + args), **kw)
File "/usr/local/lib/python3.9/site-packages/paddle/base/wrapped_decorator.py", line 26, in __impl__
  return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/paddle/jit/api.py", line 809, in wrapper
  func(layer, path, input_spec, **configs)
File "/usr/local/lib/python3.9/site-packages/decorator.py", line 232, in fun
  return caller(func, *(extras + args), **kw)
File "/usr/local/lib/python3.9/site-packages/paddle/base/wrapped_decorator.py", line 26, in __impl__
  return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/paddle/base/dygraph/base.py", line 68, in __impl__
  return func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/paddle/jit/api.py", line 1104, in save
  static_func.concrete_program_specify_input_spec(
File "/usr/local/lib/python3.9/site-packages/paddle/jit/dy2static/program_translator.py", line 986, in concrete_program_specify_input_spec
  concrete_program, _ = self.get_concrete_program(
File "/usr/local/lib/python3.9/site-packages/paddle/jit/dy2static/program_translator.py", line 875, in get_concrete_program
  concrete_program, partial_program_layer = self._program_cache[
File "/usr/local/lib/python3.9/site-packages/paddle/jit/dy2static/program_translator.py", line 1648, in __getitem__
  self._caches[item_id] = self._build_once(item)
File "/usr/local/lib/python3.9/site-packages/paddle/jit/dy2static/program_translator.py", line 1575, in _build_once
  concrete_program = ConcreteProgram.from_func_spec(
File "/usr/local/lib/python3.9/site-packages/decorator.py", line 232, in fun
  return caller(func, *(extras + args), **kw)
File "/usr/local/lib/python3.9/site-packages/paddle/base/wrapped_decorator.py", line 26, in __impl__
  return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/paddle/base/dygraph/base.py", line 68, in __impl__
  return func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/paddle/jit/dy2static/program_translator.py", line 1339, in from_func_spec
  outputs = static_func(*inputs)
File "/usr/local/lib/python3.9/site-packages/paddlenlp/transformers/ernie_layout/modeling.py", line 1169, in forward
  sequence_output, _ = self.ernie_layout(
File "/usr/local/lib/python3.9/site-packages/paddle/nn/layer/layers.py", line 1431, in __call__
  return self._dygraph_call_func(*inputs, **kwargs)
File "/usr/local/lib/python3.9/site-packages/paddle/nn/layer/layers.py", line 1410, in _dygraph_call_func
  outputs = self.forward(*inputs, **kwargs)
File "/usr/local/lib/python3.9/site-packages/paddlenlp/transformers/ernie_layout/modeling.py", line 796, in forward
  encoder_outputs = self.encoder(
File "/usr/local/lib/python3.9/site-packages/paddle/nn/layer/layers.py", line 1431, in __call__
  return self._dygraph_call_func(*inputs, **kwargs)
File "/usr/local/lib/python3.9/site-packages/paddle/nn/layer/layers.py", line 1410, in _dygraph_call_func
  outputs = self.forward(*inputs, **kwargs)
File "/usr/local/lib/python3.9/site-packages/paddlenlp/transformers/ernie_layout/modeling.py", line 414, in forward
  rel_pos = self._cal_1d_pos_emb(hidden_states, position_ids) if self.has_relative_attention_bias else None
File "/usr/local/lib/python3.9/site-packages/paddle/jit/dy2static/convert_operators.py", line 398, in convert_ifelse
  out = _run_py_ifelse(
File "/usr/local/lib/python3.9/site-packages/paddle/jit/dy2static/convert_operators.py", line 487, in _run_py_ifelse
  py_outs = true_fn() if pred else false_fn()
File "/usr/local/lib/python3.9/site-packages/paddlenlp/transformers/ernie_layout/modeling.py", line 414, in forward
  rel_pos = self._cal_1d_pos_emb(hidden_states, position_ids) if self.has_relative_attention_bias else None
File "/usr/local/lib/python3.9/site-packages/paddlenlp/transformers/ernie_layout/modeling.py", line 371, in _cal_1d_pos_emb
  rel_pos = paddle.nn.functional.one_hot(rel_pos, num_classes=self.rel_pos_onehot_size).astype(
File "/usr/local/lib/python3.9/site-packages/paddle/nn/functional/input.py", line 110, in one_hot
  helper.append_op(
File "/usr/local/lib/python3.9/site-packages/paddle/base/layer_helper.py", line 44, in append_op
  return self.main_program.current_block().append_op(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/paddle/base/framework.py", line 4467, in append_op
  op = Operator(
File "/usr/local/lib/python3.9/site-packages/paddle/base/framework.py", line 3016, in __init__
  for frame in traceback.extract_stack():

InvalidArgumentError: Illegal index value, Input(input) value should be less than Input(depth), but received input (32) not less than depth (32)
  [Hint: Expected p_in_data[i] < depth_, but received p_in_data[i]:32 >= depth_:32.] (at /paddle/paddle/phi/kernels/legacy/cpu/one_hot_kernel.cc:59)
  [operator < one_hot_v2 > error]

当前是cpu环境,麻烦帮忙看看!

AllenMeng2009 commented 5 months ago

用的是uie-x-base模型

AllenMeng2009 commented 4 months ago

是paddleocr的版本问题,安装paddleocr==2.6.1.3正常了