Class: GTE::Embedder

Inherits:
Object
  • Object
show all
Defined in:
lib/gte/embedder.rb

Class Method Summary collapse

Class Method Details

.config(model_dir) ⇒ Object



6
7
8
9
10
# File 'lib/gte/embedder.rb', line 6

def config(model_dir)
  cfg = default_config(model_dir)
  cfg = yield(cfg) if block_given?
  from_config(cfg)
end

.from_config(config) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gte/embedder.rb', line 12

def from_config(config)
  new(
    config.model_dir,
    config.threads,
    config.optimization_level,
    config.model_name.to_s,
    config.normalize,
    config.output_tensor.to_s,
    config.max_length || 0,
    config.execution_providers.to_s
  )
end