-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
DataLoader supprot dict str #31481
DataLoader supprot dict str #31481
Conversation
Thanks for your contribution! |
@@ -0,0 +1,87 @@ | |||
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2021 for new file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks!
structure.append('{}{}'.format(FIELD_PREFIX, field_idx)) | ||
flat_batch.append(field.numpy()) | ||
field_idx += 1 | ||
elif isinstance(field, (str, bytes, numbers.Number, np.number)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the difference between numbers.Number and np.number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks!
7eab9e2
to
4be15f0
Compare
"DataLoader workers.\n"); | ||
REGISTER_SIGNAL_HANDLER( | ||
SIGBUS, SIGBUS_handler, | ||
"ERROR: Unexpected BUS error encountered in DataLoader worker. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
方便在comment里附一个此类报错的示例结果吗?想看下格式
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks!
self.exc_msg = "".join(traceback.format_exception(*exc_info)) | ||
|
||
def reraise(self): | ||
msg = "DataLoader worker({}) caught {} with message:\n{}".format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
还有这个改进后的报错示例也想看下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
先approve,但目前从这两种报错格式来看,还是会给用户的使用造成困惑,估计还是会DataLoader issue不断,预估凯鹏还是会被各种问题打断日常工作,所以希望后续还能完善下,主要问题有以下几点
- 首先用户看到报错的时候没有红框,所以大概率Get不到重点
- 第一种类型的报错,我们之前写了很详细的报错提示,报到最后这个问题是能解决的,可以后面再看看
- 然后blocking queue的报错应该是对用户调试无帮助的,建议去掉,如果需要也可以改现有单测
是的,blocking queue的Receive里的EnforceNotKilled现在被test_multiprocess_reader单测里老版本PyReader的单测依赖没法删除,这个后续配合CPU tensor pipeline的调整下个PR继续优化,优化后应该能继续改进SIGBUS信号的捕获处理,这个会配合后续工作持续改进 |
|
||
def default_collate_fn(batch): | ||
""" | ||
Default batch collating function for :code:`fluid.io.DataLoader`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paddle.io.DataLoader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks!
WorkerInfo: an instance of WorkerInfo which contains fields above. | ||
|
||
.. note:: | ||
For mode usage and exampls, please see :code:`paddle.io.IterableDataset` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For mode usage and exampls -> For more usage and examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to test whether the flatten_batch affect the original speed or not
affect on original model is tested above, this PR has no affects on original model(original model datas are all in list format)
change PaddleClas data format to dict as follow, this PR also has no affects on dict format data model, speed testing result as follows
|
PR types
Function optimization
PR changes
APIs
Describe
DataLoader optimization
support data format: dict, list, str
log ERROR info when shared memory insufficient

refine blocking queue kill ENFORCE check
re-raise worker exception in main process

add CPU place guard for collate in workers to ensure tensor operations runs on CPU
no effect on speed
TODO: