Skip to content

armgit / sie

Public Imported from GitHub
0

Open-source inference server and production cluster for all the models your agent needs.

2.7 KB
Raw Blame
sie_id: nvidia/NV-Embed-v2
# Mirror of nvidia/NV-Embed-v2 with transformers-5.x compatibility patches in
# modeling_nvembed.py (DynamicCache API, rotary position_embeddings). Verified
# 2026-07-06: weight files sha-identical to nvidia/NV-Embed-v2, configuration
# identical, modeling diff is compat-only; latent-attention stack intact (#1692).
hf_id: Hyukkyu/nv-embed-v2
hf_revision: 7d27cd8010d1be665351a1e226471d0d6c16afcb
inputs:
  text: true
  image: false
  audio: false
  video: false
tasks:
  encode:
    dense:
      dim: 4096
    sparse: null
    multivector: null
  score: null
  extract: null
max_sequence_length: 32768
profiles:
  default:
    max_batch_tokens: 16384
    compute_precision: null
    adapter_path: sie_server.adapters.pytorch_embedding:PyTorchEmbeddingAdapter
    adapter_options:
      loadtime:
        trust_remote_code: true
        uses_legacy_transformers_cache: true
        attn_implementation: eager
        # NV-Embed-v2's defining feature is latent-attention pooling with
        # instruction-masked mean + EOS append + right padding — none of which
        # the generic tokenize/forward/pool pipeline reproduces (calling the
        # forward without pool_mask returns the UNPOOLED latent sequence, which
        # was then last-token pooled: NFCorpus -17%, #1692). Delegate to the
        # checkpoint's own encode(prompts, instruction=...) instead. The
        # checkpoint's sentence-transformers chain is NOT an option: it predates
        # ST 5.x, whose Transformer module requires last_hidden_state in the
        # forward output while NVEmbedModel returns only sentence_embeddings.
        use_model_encode: true
      runtime:
        normalize: true
        # Official NV-Embed query recipe; documents are encoded raw (no prefix).
        # The rendered prefix is passed as the model's `instruction`, so
        # is_mask_instruction excludes it from the pooling mean.
        query_template: "Instruct: {instruction}\nQuery: {text}"
  # NV-Embed-v2 needs an 80 GB card. The checkpoint's code builds its Mistral
  # body from a float32 text config, so the weights take about 28 GB on the
  # GPU, and a forward pass under the checkpoint's float16 autocast adds about
  # 14 GB. Measured through sie-server on one H100 80GB: 29,065 MiB after
  # load, 42,993 MiB after a one-sentence query, 67,113 MiB for 32 documents
  # of 642 tokens, and 75,041 MiB for one 21,122-token document; a
  # 41,602-token document did not raise the peak. It does not load on a
  # 24 GB L4 and runs out of memory on its first request on an A100 40GB.
  # The hardware name records the tested pairing; callers and operators
  # still select the machine profile.
  h100:
    extends: default