Class: GTE::Embedder
- Inherits:
-
Object
- Object
- GTE::Embedder
- Defined in:
- lib/gte/embedder.rb
Constant Summary collapse
- DEFAULT_THREADS =
0- DEFAULT_OPTIMIZATION_LEVEL =
3
Class Method Summary collapse
Class Method Details
.config(model_dir) ⇒ Object
9 10 11 12 13 |
# File 'lib/gte/embedder.rb', line 9 def config(model_dir) cfg = default_config(model_dir) cfg = yield(cfg) if block_given? from_config(cfg) end |
.default_config(model_dir) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/gte/embedder.rb', line 29 def default_config(model_dir) Config::Text.new( model_dir: File.(model_dir), threads: DEFAULT_THREADS, optimization_level: DEFAULT_OPTIMIZATION_LEVEL, model_name: nil, normalize: true, output_tensor: nil, max_length: nil, padding: nil, execution_providers: nil ) end |
.from_config(config) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gte/embedder.rb', line 15 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.padding.to_s, config.execution_providers.to_s ) end |