Skip to content
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

用自己的数据集进行推理程序阻塞了,batch_size已经设置为1 #16

Open
pooregg opened this issue Oct 11, 2024 · 7 comments

Comments

@pooregg
Copy link

pooregg commented Oct 11, 2024

作者您好,我在自己数据集上进行推理,进程阻塞在这行代码不继续执行,不知道是什么原因。

/root/project2024/DepictQA/src/infer.py(56)main()
-> texts, output_ids, probs, confidences = model.generate(
(Pdb) n

推理脚本为:
#!/bin/bash
src_dir=../../src/
export PYTHONPATH=$src_dir:$PYTHONPATH
export CUDA_VISIBLE_DEVICES=$1

python $src_dir/infer.py
--meta_path IQA_data20240924/ref_data/white_balance_label/3_test.json
--dataset_name livemd_AB
--task_name quality_compare_noref
--batch_size 1 \

模型ckpt.pt 是在自己数据集上训练得到的
另外很奇怪的一点,ctrl+c 杀死推理进程时,则会得到一个answer,
譬如:
{"id": "000007", "text": "{"white_balance": "8"}\n ", "output_id": null, "prob": null, "confidence": null}
但是后续仍继续阻塞。

@zhiyuanyou
Copy link
Collaborator

我遇到阻塞问题都是batch_size大于1的padding引起的,而且比例很低,大概1000个里面只有1个。

你这个比例如何?

@zhiyuanyou
Copy link
Collaborator

ctrl+c杀死进程时,得到answer是正常的,因为阻塞的进程被kill了。这也是阻塞的正常表现。

@pooregg
Copy link
Author

pooregg commented Oct 12, 2024

感谢回复,问题已定位到
我用的自己构造的数据集训练得到的模型ckpt.pt
在这个文件的:https://github.com/XPixelGroup/DepictQA/blob/main/src/model/utils/confidence.py
120-124陷入死循环:
while True:
# [7084, 319]: "Image A", [7084, 350]: "Image B"
if output_id[idx : idx + 2] in [[7084, 319], [7084, 350]]:
break
idx += 1

@pooregg
Copy link
Author

pooregg commented Oct 12, 2024

我遇到阻塞问题都是batch_size大于1的padding引起的,而且比例很低,大概1000个里面只有1个。

你这个比例如何?

每条数据都阻塞。是因为输出结果中没有 "Image A" 或 "Image B"么

@zhiyuanyou
Copy link
Collaborator

修改一下config文件中的:"output_confidence: true",不output confidence就可以了。

我之前写的代码,输入两张图像对比+回答长度很短的case,默认检测"Image A" 或 "Image B"来计算confidence了。

@zhiyuanyou
Copy link
Collaborator

你需要根据自己的任务确定关键token,并写一个检测关键token的代码来确定置信度。

@pooregg
Copy link
Author

pooregg commented Oct 12, 2024

好的,感谢您的回复!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants