-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Describe a requested feature
I was running some performance tests and I noticed that checking if an object is pickable:
outputs = self.check_picklable(outputs) |
check_pickable
helps, as dataclasses and ModelOutput
should be as pickable as its dictionary representation.
If the check is still needed, I guess the code could be still sped up by modifying an object only on pickle failure. That would require some workarounds (perhaps overriding https://github.com/python/cpython/blob/9dc787ea96916552695e79397588fdfa68f22024/Lib/multiprocessing/queues.py#L275) so I want to make sure the check is still necessary, before giving it a shot. Another option is to always check for
parallelformers/parallelformers/parallel/process.py
Lines 236 to 239 in ccaea51
if _is_dataclass_instance(obj) or isinstance(obj, ModelOutput): | |
_obj = asdict(obj) | |
_obj["orig_dataclass_type"] = obj.__class__ | |
obj = _obj |
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request