autobatch
AutoBatchedPotential
Bases: Potential
AutoBatchedPotential is a wrapper around a Potential that enables automatic batching of concurrent requests.
This class manages a background loop that collects concurrent requests to instance methods
(complete
, prefix
, score
, logw_next
) and batches them together before
delegating to the corresponding batch methods of the underlying potential
(batch_complete
, batch_prefix
, batch_score
, batch_logw_next
).
This class inherits all methods from Potential
.
Attributes:
Name | Type | Description |
---|---|---|
potential |
Potential
|
The underlying potential instance that is being wrapped. |
background_loop |
AsyncBatchLoop
|
An asynchronous loop that manages batch requests. |
Source code in genlm/control/potential/autobatch.py
AsyncBatchLoop
Asynchronous batch processing loop for potential methods.
Source code in genlm/control/potential/autobatch.py
start()
queue_request(batch_method_name, arg_accumulator)
Queue a request for batch processing.
close()
Stop the background processing task and cleanup resources.
Source code in genlm/control/potential/autobatch.py
cleanup()
async
Async cleanup - preferred method