-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
kie训练自定义数据集,配置文件指定预训练模型不生效 #13627
Comments
和你一样的情况,有解决方案了么? |
怎么解决呢? |
你的pretrained model下载好以后是怎么样的?我下载的tar文件解压后,还是一个没有后缀的压缩文件,改了后缀后再解压得到3个文件,但是缺.pdopt文件,所以还是不能当预训练模型用 |
This issue is stale because it has been open for 90 days with no activity. |
我是用cpu训练的ser+re,导出为inference模型后,用官方的predict_kie_token_ser_re.py脚本去推理的时候,就会报这个错误:ValueError: (InvalidArgument) The dims of Input(X) should be greater than 0 |
我用的GPU训练出来了re模型,但是还没有导出为inference模型,但是我用训练好的re模型推理的时候训练结果很差,请问可以交流一下吗 |
不好意思哈,我目前还在尝试Issues其他人提供的解决思路,看推理的时候,还会不会报我之前说的那个错误,因为我没有推理成功,所以我也不知道我的预测结果的好坏,但是你如果没有报错了,仅仅是预测结果不太理想的话,你可以优先看看同类数据集是否>50张以上,并且改善一下学习率等等
冰封
***@***.***
…------------------ 原始邮件 ------------------
发件人: "PaddlePaddle/PaddleOCR" ***@***.***>;
发送时间: 2025年2月8日(星期六) 下午4:43
***@***.***>;
***@***.******@***.***>;
主题: Re: [PaddlePaddle/PaddleOCR] kie训练自定义数据集,配置文件指定预训练模型不生效 (Issue #13627)
我是用cpu训练的ser+re,导出为inference模型后,用官方的predict_kie_token_ser_re.py脚本去推理的时候,就会报这个错误:ValueError: (InvalidArgument) The dims of Input(X) should be greater than 0 [Hint: Expected x_dims[i] > 0, but received x_dims[i]:0 <= 0:0.] (at ..\paddle\phi\kernels\cpu\stack_kernel.cc:34) 但是如果我只推理ser也就是用官方的predict_kie_token_ser.py脚本就不会有任何问题,感觉re就是半成品
我用的GPU训练出来了re模型,但是还没有导出为inference模型,但是我用训练好的re模型推理的时候训练结果很差,请问可以交流一下吗
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
你可以先不用导出为inference,可以直接使用如下命令来推理, |
谢谢,你指出来的,我试过的,无论导出还是不到出都还是会报错,不过今天上午确定了,确实是我re标签有问题,从新调整数据集后没这个问题了,但是我也发现精度很低,我再尝试是否把det模型从新训练一下,然后再从新把ser也多训练一下,最后再从新训练re模型,我把他们训练的轮数都增加一下,有可能是我之前只训练了200轮导致检测效果不好,然后连锁反应到see+re检测的效果都不好
…---原始邮件---
发件人: ***@***.***>
发送时间: 2025年2月10日(周一) 下午3:02
收件人: ***@***.***>;
抄送: ***@***.******@***.***>;
主题: Re: [PaddlePaddle/PaddleOCR] kie训练自定义数据集,配置文件指定预训练模型不生效 (Issue #13627)
不好意思哈,我目前还在尝试Issues其他人提供的解决思路,看推理的时候,还会不会报我之前说的那个错误,因为我没有推理成功,所以我也不知道我的预测结果的好坏,但是你如果没有报错了,仅仅是预测结果不太理想的话,你可以优先看看同类数据集是否>50张以上,并且改善一下学习率等等
冰封
@.***
…
你可以先不用导出为inference,可以直接使用如下命令来推理,
python3 ./tools/infer_kie_token_ser_re.py -c configs/kie/vi_layoutxlm/re_vi_layoutxlm_hukoubu_zh.yml -o Architecture.Backbone.checkpoints=/root/project/PaddleOCR/output/re_vi_layoutxlm_xfund_zh/latest Global.infer_img=./images/hukoubu_huangxinghua.jpg -c_ser configs/kie/vi_layoutxlm/ser_vi_layoutxlm_hukoubu_zh.yml -o_ser Architecture.Backbone.checkpoints=/root/project/PaddleOCR/output/ser_vi_layoutxlm_hukoubu_zh/best_accuracy
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
经过昨天我重新训练了det模型后,然后ser+re都加入det+rec模型去训练, 我发现re的学习率非常非常低,训练完我就去推理了一下,惨不忍睹,有可能需要修改优化器和学习率,也有可能必须得放弃ser+re,改用向量大模型语义匹配分析,再结合提示词工程,让大模型来结构化 |
ser+re如何配置的训练参数的,可以分享一下吗 |
参数可变的也就配置文件中的Optimizer,以及Global下的epoch_num,这些参数会影响模型训练,目前我还在调整参数不停的训练,看那种会更好,我贴一个,我目前训练的参数,但是也不能保证效果好不好 |
Search before asking
I have searched the PaddleOCR Docs and found no similar bug report.
I have searched the PaddleOCR Issues and found no similar bug report.
I have searched the PaddleOCR Discussions and found no similar bug report.
Bug
如题:我是在百度studio进行训练,参考官方文档进行操作https://github.com/PaddlePaddle/PaddleOCR/blob/main/doc/doc_ch/kie.md,
我首先训练的是ser模型,配置内容如下:
pretrained_model: ./pretrained_model/ser_vi_layoutxlm_xfund_pretrained 这一行配置是我新加的。当我执行训练命令:
%cd /home/aistudio/PaddleOCR !python3 tools/train.py -c configs/kie/vi_layoutxlm/ser_vi_layoutxlm_xfund_zh.yml
可以看到日志还是会默认下载模型并没有使用我配置的预训练模型,

我的需求是:我希望使用官网文档提供的预训练模型进行自定义数据的训练。
Environment
百度studio
aiofiles==23.2.1
aiohttp==3.9.5
aiosignal==1.3.1
aistudio-sdk @ file:///home/aistudio/aistudio_sdk-0.2.4-py3-none-any.whl#sha256=d93411cc8764e465860cbf2f97f787dddd1548595d4776c97ddf0ea787dedd81
albucore==0.0.13
albumentations==1.4.10
altair==4.2.2
annotated-types==0.6.0
anyio==4.3.0
astor==0.8.1
asttokens==2.4.1
async-timeout==4.0.3
attrdict3==2.0.2
attrs==23.2.0
Babel==2.14.0
bce-python-sdk==0.9.6
beautifulsoup4==4.12.3
blinker==1.7.0
cachetools==5.3.3
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
coloredlogs==15.0.1
colorlog==6.8.2
comm==0.2.2
contourpy==1.2.1
cycler==0.12.1
Cython==3.0.11
datasets==2.19.0
debugpy==1.8.1
decorator==5.1.1
dill==0.3.4
easydict==1.13
entrypoints==0.4
exceptiongroup==1.2.1
executing==2.0.1
fastapi==0.110.2
ffmpy==0.3.2
filelock==3.13.4
fire==0.6.0
Flask==3.0.3
Flask-Babel==2.0.0
flatbuffers==24.3.25
fonttools==4.51.0
frozenlist==1.4.1
fsspec==2024.3.1
future==1.0.0
gitdb==4.0.11
GitPython==3.1.43
gradio==3.40.0
gradio_client==0.15.1
gunicorn==22.0.0
h11==0.14.0
httpcore==1.0.5
httpx==0.27.0
huggingface-hub==0.22.2
humanfriendly==10.0
idna==3.7
imageio==2.34.2
imgaug==0.4.0
importlib_metadata==7.1.0
importlib_resources==6.4.0
ipykernel==6.29.4
ipython==8.23.0
itsdangerous==2.2.0
jedi==0.19.1
jieba==0.42.1
Jinja2==3.1.3
joblib==1.4.0
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
jupyter_client==8.6.1
jupyter_core==5.7.2
kiwisolver==1.4.5
lazy_loader==0.4
linkify-it-py==2.0.3
lmdb==1.5.1
lxml==5.2.2
markdown-it-py==2.2.0
MarkupSafe==2.1.5
matplotlib==3.8.4
matplotlib-inline==0.1.7
mdit-py-plugins==0.3.3
mdurl==0.1.1
mpmath==1.3.0
multidict==6.0.5
multiprocess==0.70.12.2
nest-asyncio==1.6.0
networkx==3.3
numpy==1.26.4
onnx==1.16.0
onnxruntime==1.17.3
opencv-contrib-python==4.10.0.84
opencv-python==4.9.0.80
opencv-python-headless==4.10.0.84
opt-einsum==3.3.0
orjson==3.10.1
packaging==24.0
paddle2onnx==1.2.1
paddlefsl==1.1.0
paddlehub==2.4.0
paddlenlp==2.5.2
paddleocr==2.8.1
paddlepaddle-gpu @ file:///tmp/paddlepaddle_gpu-2.5.2-cp310-cp310-linux_x86_64.whl#sha256=2b4a84c853c7c88ddf4984c667bfcb824cc8a28a674448099452f50c686cc1bb
pandas==2.2.2
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
pillow==10.3.0
platformdirs==4.2.0
prettytable==3.10.0
prompt-toolkit==3.0.43
protobuf==3.20.3
psutil==5.9.8
ptyprocess==0.7.0
pure-eval==0.2.2
pyarrow==16.0.0
pyarrow-hotfix==0.6
pybind11==2.12.0
pyclipper==1.3.0.post5
pycryptodome==3.20.0
pydantic==2.7.0
pydantic_core==2.18.1
pydeck==0.9.1
pydub==0.25.1
Pygments==2.17.2
Pympler==1.0.1
pypandoc==1.13
pyparsing==3.1.2
python-dateutil==2.9.0.post0
python-docx==1.1.2
python-multipart==0.0.9
pytz==2024.1
PyYAML==6.0.1
pyzmq==26.0.2
rapidfuzz==3.9.6
rarfile==4.2
referencing==0.34.0
requests==2.31.0
rich==13.7.1
rpds-py==0.18.0
ruff==0.4.1
safetensors==0.4.3
scikit-image==0.24.0
scikit-learn==1.4.2
scipy==1.13.0
semantic-version==2.10.0
semver==3.0.2
sentencepiece==0.2.0
seqeval==1.2.2
shapely==2.0.5
shellingham==1.5.4
six==1.16.0
smmap==5.0.1
sniffio==1.3.1
soupsieve==2.5
stack-data==0.6.3
starlette==0.37.2
streamlit==1.13.0
streamlit-image-comparison==0.0.4
sympy==1.12
termcolor==2.4.0
threadpoolctl==3.4.0
tifffile==2024.7.24
toml==0.10.2
tomli==2.0.1
tomlkit==0.12.0
tool-helpers==0.1.1
toolz==0.12.1
tornado==6.4
tqdm==4.66.2
traitlets==5.14.3
typer==0.12.3
typing_extensions==4.11.0
tzdata==2024.1
tzlocal==5.2
uc-micro-py==1.0.3
urllib3==2.2.1
uvicorn==0.29.0
validators==0.28.3
visualdl==2.4.2
watchdog==4.0.1
wcwidth==0.2.13
websockets==11.0.3
Werkzeug==3.0.2
xxhash==3.4.1
yacs==0.1.8
yarl==1.9.4
zipp==3.19.2
Minimal Reproducible Example
Additional
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: