Class: Cohere::Transcribe::ASR::RetryBatchCap
- Inherits:
-
Object
- Object
- Cohere::Transcribe::ASR::RetryBatchCap
- Defined in:
- lib/cohere/transcribe/asr/batching.rb
Overview
A batch cap scoped to higher-token truncation retries. An OOM here must not reduce the ordinary ASR controller learned from the base limit.
Instance Attribute Summary collapse
-
#current_size ⇒ Object
readonly
Returns the value of attribute current_size.
Instance Method Summary collapse
-
#initialize(current_size) ⇒ RetryBatchCap
constructor
A new instance of RetryBatchCap.
- #record_oom(attempted_rows) ⇒ Object
Constructor Details
#initialize(current_size) ⇒ RetryBatchCap
Returns a new instance of RetryBatchCap.
253 254 255 256 |
# File 'lib/cohere/transcribe/asr/batching.rb', line 253 def initialize(current_size) @current_size = Integer(current_size) raise ArgumentError, "current_size must be positive" unless @current_size.positive? end |
Instance Attribute Details
#current_size ⇒ Object (readonly)
Returns the value of attribute current_size.
251 252 253 |
# File 'lib/cohere/transcribe/asr/batching.rb', line 251 def current_size @current_size end |
Instance Method Details
#record_oom(attempted_rows) ⇒ Object
258 259 260 261 262 263 |
# File 'lib/cohere/transcribe/asr/batching.rb', line 258 def record_oom(attempted_rows) rows = Integer(attempted_rows) proposed = rows > 1 ? rows / 2 : 1 @current_size = [1, [@current_size, proposed].min].max self end |