Skip to content

Commit

Permalink
[#4128] temp fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KimSoungRyoul committed Aug 20, 2023
1 parent 47241b1 commit 6743e12
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/bentoml/_internal/marshal/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,6 @@ async def train_optimizer(
if self.max_batch_size < batch_size:
batch_size = self.max_batch_size

if batch_size > 1:
wait = min(
self.max_latency * 0.95,
(batch_size * 2 + 1) * (self.optimizer.o_a + self.optimizer.o_b),
)

req_count = 0
try:
while req_count < num_reqs_to_train:
Expand All @@ -217,6 +211,10 @@ async def train_optimizer(
if batch_size > 1: # only wait if batch_size
a = self.optimizer.o_a
b = self.optimizer.o_b
wait = min(
self.max_latency * 0.95,
(batch_size * 2 + 1) * (self.a + self.optimizer.o_b),
)

if n < batch_size and (batch_size * a + b) + w0 <= wait:
await asyncio.sleep(self.tick_interval)
Expand Down

0 comments on commit 6743e12

Please sign in to comment.