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

feat(bridge): disable ckpt for spg server runner #163

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions kag/bridge/spg_server_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def run_reader(self, config, input_data):
reader = interface.ReaderABC.from_config(reader_config)
chunks = []
for data in scanner.generate(input_data):
chunks += reader.invoke(data)
chunks += reader.invoke(data, write_ckpt=False)
return [x.to_dict() for x in chunks]

def run_component(self, component_name, component_config, input_data):
Expand All @@ -35,4 +35,6 @@ def run_component(self, component_name, component_config, input_data):

cls = getattr(interface, component_name)
instance = cls.from_config(component_config)
return [x.to_dict() for x in instance.invoke(input_data)]
if hasattr(instance.input_types, "from_dict"):
input_data = instance.input_types.from_dict(input_data)
return [x.to_dict() for x in instance.invoke(input_data, write_ckpt=False)]
3 changes: 2 additions & 1 deletion kag/interface/builder/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def _invoke(self, input: Input, **kwargs) -> List[Output]:
)

def invoke(self, input: Input, **kwargs) -> List[Output]:
if self.checkpointer:
write_ckpt = kwargs.get("write_ckpt", True)
if write_ckpt and self.checkpointer:
input_key = kwargs.get("key")
# found existing data in checkpointer
if input_key and self.checkpointer.exists(input_key):
Expand Down
Loading