gte 0.0.12-x86_64-linux → 0.0.13-x86_64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23560cdb3c9c908ba6edb00720125fd719a13c8f6f36baa3352e069bd8784bb9
4
- data.tar.gz: cd439d8937edf771a123b9f64e54a8254c4eec3b432947392077c582589726de
3
+ metadata.gz: d91f5c0d89ad9b423d8cc0aa6beb349740d087dedc85fd2c8a6cc57762edaabf
4
+ data.tar.gz: d46f37e1e3ebfef95bc29eff93904c7195d9e11fa6b57896031efdbf2346dbdd
5
5
  SHA512:
6
- metadata.gz: fcd7afb00b292447a6906a599e598ad8cef8751082372dea8d7031010eefc21c0dc0af6cd1870078799152a54b9bb14f795b1a335973cdb0ef58cf556ab81c39
7
- data.tar.gz: 5c1b2e6b4a3bfb5f647da1786939f329d462f03fa209558a53ea3165af57cbfb33b4a5712df718dc1f2d36967e384784a23e94e0e792e707eb34de700a5430a0
6
+ metadata.gz: 8bb9df2128011282a0b8ebcde4d885be18b204e7659ab108d0aa1dbcd660f405f359cc7e3ce20447cfe8e8a145e65e9d49995b21a6c948f3a44d8a102d68533b
7
+ data.tar.gz: d8cdc887855b3d8cff93b9134435609fd1fc77bf22290dec68d85b0e9dae785511c6d73c05e142061b3543dde1aa01a56a399cb3a6129b1812bf71733d58e5ee
data/README.md CHANGED
@@ -59,6 +59,43 @@ Notes:
59
59
  - Return a `Config::Text` from the block (for example, `config.with(...)`).
60
60
  - Model instances are cached by full config key; different config values create different cached instances.
61
61
 
62
+ Common model presets:
63
+
64
+ ```ruby
65
+ e5 = GTE.config(ENV.fetch("GTE_MODEL_DIR")) do |config|
66
+ config.with(
67
+ model_name: "model.onnx",
68
+ output_tensor: "last_hidden_state",
69
+ max_length: 512,
70
+ execution_providers: "cpu"
71
+ )
72
+ end
73
+
74
+ siglip2 = GTE.config(ENV.fetch("GTE_SIGLIP2_DIR")) do |config|
75
+ config.with(
76
+ model_name: "text_model_int8.onnx",
77
+ output_tensor: "pooler_output",
78
+ max_length: 64,
79
+ execution_providers: "cpu"
80
+ )
81
+ end
82
+
83
+ clip = GTE.config(ENV.fetch("GTE_CLIP_DIR")) do |config|
84
+ config.with(
85
+ output_tensor: "sentence_embedding",
86
+ max_length: 512,
87
+ execution_providers: "cpu"
88
+ )
89
+ end
90
+ ```
91
+
92
+ Picking a specific layer:
93
+
94
+ - Use `output_tensor:` to request a named model output.
95
+ - `last_hidden_state` gives token-level hidden states and is mean-pooled by `gte` when the tensor is rank 3.
96
+ - `pooler_output`, `sentence_embedding`, and similar 2D tensors are returned directly and then L2-normalized by default.
97
+ - If the requested tensor is not present in the model, `gte` raises an error instead of silently falling back.
98
+
62
99
  Low-level embedder setup (without model cache):
63
100
 
64
101
  ```ruby
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.12
1
+ 0.0.13
data/ext/gte/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "gte"
3
- version = "0.0.12"
3
+ version = "0.0.13"
4
4
  edition = "2021"
5
5
  authors = ["elcuervo <elcuervo@elcuervo.net>"]
6
6
  license = "MIT"
@@ -7,7 +7,7 @@ use ndarray::{Array2, ArrayView2, ArrayViewD, Ix2};
7
7
  use ort::execution_providers::{
8
8
  CoreMLExecutionProvider, ExecutionProviderDispatch, XNNPACKExecutionProvider,
9
9
  };
10
- use ort::session::Session;
10
+ use ort::session::{OutputSelector, RunOptions, Session};
11
11
  use std::path::{Path, PathBuf};
12
12
  use std::sync::atomic::{AtomicUsize, Ordering};
13
13
  use std::sync::{Condvar, Mutex};
@@ -216,8 +216,11 @@ pub fn run_session(
216
216
  config: &ModelConfig,
217
217
  ) -> Result<Array2<f32>> {
218
218
  let input_tensors = InputTensors::from_tokenized(tokenized, config.with_attention_mask)?;
219
+ let run_opts = RunOptions::new()
220
+ .map_err(|e| GteError::Ort(e.to_string()))?
221
+ .with_outputs(OutputSelector::no_default().with(config.output_tensor.as_str()));
219
222
  let outputs = session
220
- .run(input_tensors.inputs)
223
+ .run_with_options(input_tensors.inputs, &run_opts)
221
224
  .map_err(|e| GteError::Ort(e.to_string()))?;
222
225
  let array = extract_output_tensor(&outputs, config.output_tensor.as_str())?;
223
226
 
data/lib/gte/gte.so CHANGED
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gte
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - elcuervo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-13 00:00:00.000000000 Z
11
+ date: 2026-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake