Skip to content
Commit 521f38f0 authored by Stefy Lanza (nextime / spora )'s avatar Stefy Lanza (nextime / spora )
Browse files

the vision tower stays at full precision, and two embedders that needed a shim each



Four text-and-image embedders were added last commit; making them actually
answer took three fixes measured against the live models.

Quantization now skips the vision tower and the projector by default
(hf_loading.quant_skip_modules). For a vision-language EMBEDDER those are the
part being judged: the tower turns pixels into the vector that gets compared,
the projector is one small matrix whose error lands on every image, and
together they are a fraction of a 7B's weights -- so nf4 there saves almost
nothing and spends it in the worst place. An explicit empty quant_skip_modules
on the model entry still means "quantize all of it".

jina-clip-v2 and MM-Embed each needed one thing transformers 5 took away:

* `dtype=`, not `torch_dtype=`. The old name is still accepted for most
  models, but a model whose remote code forwards **kwargs into the config dies
  with "TypeError: attribute name must be string, not 'torch.dtype'", which
  reads like a corrupt checkpoint.
* `AutoModel.register(..., exist_ok=True)`. MM-Embed's modeling_nvmmembed
  registers LlavaNextConfig, which transformers already owns, and 5.x refuses a
  duplicate instead of ignoring it.
* `clip_loss`, deleted from modeling_clip while `contrastive_loss`, which it is
  two lines of, is still there. Restored from it rather than vendored.

Embeddings are also checked for NaN/Inf before they are returned
(_require_finite): a vector of NaNs scores every comparison equally and
silently, and that is what jina-clip-v2's image tower returns on this stack --
so it now answers with an error instead of nonsense.

Co-Authored-By: default avatarClaude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014T3rZozi1Ehk96NG1WesgC
parent 5cee01e7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment