Class: Transformers::ChunkPipeline

Inherits:
Pipeline
  • Object
show all
Defined in:
lib/transformers/pipelines/base.rb

Instance Method Summary collapse

Methods inherited from Pipeline

#_ensure_tensor_on_device, #call, #check_model_type, #get_iterator, #initialize, #torch_dtype

Constructor Details

This class inherits a constructor from Transformers::Pipeline

Instance Method Details

#run_single(inputs, preprocess_params, forward_params, postprocess_params) ⇒ Object



304
305
306
307
308
309
310
311
312
# File 'lib/transformers/pipelines/base.rb', line 304

def run_single(inputs, preprocess_params, forward_params, postprocess_params)
  all_outputs = []
  preprocess(inputs, **preprocess_params) do |model_inputs|
    model_outputs = forward(model_inputs, **forward_params)
    all_outputs << model_outputs
  end
  outputs = postprocess(all_outputs, **postprocess_params)
  outputs
end