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

Fix retries during inference #523

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion src/petals/client/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ClientConfig:

max_retries: Optional[int] = DEFAULT_MAX_RETRIES # max number of retries before an exception (default: inf)
min_backoff: float = 1 # after a repeated failure, sleep for this many seconds times 2 ** (num_failures - 1)
max_backoff: float = 60 # limit maximal sleep time between retries to this value
max_backoff: float = 5 # limit maximal sleep time between retries to this value
ban_timeout: float = 15 # when a remote peer fails to respond, prevent routing to that peer for this many seconds
active_adapter: Optional[str] = None # name of active LoRA adapter (usually, Hugging Face repo)

Expand Down
6 changes: 6 additions & 0 deletions src/petals/client/inference_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ def step(
)
)
)

import random

if random.random() < 0.05:
raise Exception("fail")

outputs = list(map(deserialize_torch_tensor, outputs_serialized.tensors))
assert (
outputs[0].shape == inputs.shape
Expand Down
Loading