File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -693,17 +693,20 @@ def create_request_timings(
693
693
Divides the total rate evenly across all worker processes to maintain
694
694
the specified aggregate rate.
695
695
696
- :param local_rank: The rank of the worker process (unused) .
696
+ :param local_rank: The rank of the worker process.
697
697
:param local_world_size: Total number of worker processes for rate division.
698
698
:param local_max_concurrency: The maximum number of concurrent requests
699
699
for the worker process.
700
700
:return: ConstantRateRequestTimings instance with per-worker rate.
701
701
"""
702
702
# Divide the rate evenly across all worker processes
703
703
worker_rate = self .rate / local_world_size
704
+ # Start each worker with an offset to interleave rates
705
+ worker_offset = (1 / self .rate ) * local_rank
704
706
705
707
return ConstantRateRequestTimings (
706
708
rate = worker_rate ,
709
+ offset = worker_offset ,
707
710
)
708
711
709
712
@@ -768,7 +771,11 @@ def create_request_timings(
768
771
worker_rate = self .rate / local_world_size
769
772
# Use a different seed for each worker to ensure different sequences
770
773
worker_seed = self .random_seed + local_rank
774
+ # Start each worker with an offset to interleave rates
775
+ worker_offset = (1 / self .rate ) * local_rank
776
+
771
777
return PoissonRateRequestTimings (
772
778
rate = worker_rate ,
773
779
random_seed = worker_seed ,
780
+ offset = worker_offset ,
774
781
)
You can’t perform that action at this time.
0 commit comments