增加两个实际训练过程中遇到的问题及解决方案
pull/10290/head
tanjh 2023-06-28 13:26:48 +08:00 committed by GitHub
parent 991fb7c46a
commit df064f4538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -505,3 +505,13 @@ RE可视化结果默认保存到`./output`文件夹里面,结果示例如下
Q1: 训练模型转inference 模型之后预测效果不一致?
**A**该问题多是trained model预测时候的预处理、后处理参数和inference model预测的时候的预处理、后处理参数不一致导致的。可以对比训练使用的配置文件中的预处理、后处理和预测时是否存在差异。
Q2: 训练过程中报如下错误:
ValueError: (InvalidArgument) The 'shape' attribute in ReshapeOp is invalid. The input tensor X'size must be divisible by known capacity of 'shape'. But received X's shape = [4, 512, 23], X's size = 47104, 'shape' is [-1, 7], known capacity of 'shape' is -7.
**A**是由于训练使用的配置文件ser_vi_layoutxlm_xfund_zh.yml中Architecture.Backbone.num_classes的值与Loss.num_classes的值不一致导致。
Q3: 训练过程中报如下错误:
IndexError: (OutOfRange) label value should less than the shape of axis dimension when label value(23) not equal to ignore_index(-100), But received label value as 23 and shape of axis dimension is 23.
**A**是由于训练使用的配置文件ser_vi_layoutxlm_xfund_zh.yml中Architecture.Backbone.num_classes的值与Loss.num_classes的值不正确。
由于采用BIO标注所以默认会有一个"O"标签,同时会忽略"OTHER", "OTHERS", "IGNORE"三个标签。PostProcess.class_path设置的字典文件中的每种类型会自动扩展成"B-"和"I-"为前缀的标签。
所以假设字典文件中包含n个类型(包含OTHER)时num_classes应该为2n-1假设字典文件中包含n个类型(不含OTHER)时num_classes应该为2n+1。