autobatch
AutoBatchedPotential
Bases: Potential
AutoBatchedPotential is a wrapper around a Potential that enables automatic batching of concurrent requests.
This class 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. |
Source code in genlm/control/potential/autobatch.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
autobatched(potential)
Return the autobatched view of a potential.
Memoized on the potential, so every call site shares one wrapper and one batch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
potential
|
Potential
|
The potential to wrap. |
required |
Returns:
| Type | Description |
|---|---|
AutoBatchedPotential
|
The potential's autobatched wrapper. |