[Bugfix] Fix pickle of input when async output processing is on (#9931)

Signed-off-by: Wallas Santos <wallashss@ibm.com>
This commit is contained in:
Wallas Henrique
2024-11-06 00:39:26 +00:00
committed by GitHub
parent 43300bd98a
commit 966e31697b
2 changed files with 38 additions and 0 deletions
+12
View File
@@ -136,6 +136,18 @@ class ModelInputForGPU(ModelRunnerInputBase):
attn_backend, tensor_dict)
return cls(**tensor_dict)
# Exclude `async_callback` to be able to pickle this object
def __getstate__(self):
state = self.__dict__.copy()
del state["async_callback"]
return state
# TODO: What happens when we depickle this object?
# How can we update this callback to properly pass it to the engine?
def __setstate__(self, state):
self.__dict__.update(state)
self.__dict__.update({'async_callback': None})
@dataclass(frozen=True)
class ModelInputForGPUWithSamplingMetadata(ModelInputForGPU):