Downloads · 30 days
8
4% of all-time downloads
Afrostnova/clip-text-msmarco-inversion
clip-text-msmarco-inversion is a machine learning model from Afrostnova. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for vec2text. The card lists the license as other.
A vec2text inversion (hypothesizer) model that reconstructs text from the embeddings produced by the CLIP ViT-L/14 text encoder (the text encoder used by Stable Diffusion v1.5, identical to openai/clip-vit-large-patch…
Downloads · 30 days
8
4% of all-time downloads
All-time downloads
205
Public
Parameters
356M
1.4 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors1.4 GB · 100%
From the Hugging Face model README
A vec2text inversion (hypothesizer) model that reconstructs text from the
embeddings produced by the CLIP ViT-L/14 text encoder (the text encoder used by
Stable Diffusion v1.5, identical to openai/clip-vit-large-patch14).
It is the first-stage model: given a CLIP text embedding, it produces an initial
text hypothesis. Pair it with the corrector model
Afrostnova/clip-text-msmarco-corrector
to iteratively refine that hypothesis.
vec2text InversionModel (T5-based encoder–decoder)CLIPTextModel — openai/clip-vit-large-patch14repeat (num_repeat_tokens=16)This is not loadable with the upstream pip install vec2text package — upstream
does not support a CLIPTextModel embedder. You need the fork that adds CLIP support
(the one this model was trained with). With the wrong version, from_pretrained fails
because the CLIPTextModel embedder is unknown.
import vec2text
inv = vec2text.models.InversionModel.from_pretrained("Afrostnova/clip-text-msmarco-inversion")
cor = vec2text.models.CorrectorEncoderModel.from_pretrained("Afrostnova/clip-text-msmarco-corrector")
corrector = vec2text.load_corrector(inv, cor)
# `embeddings` = CLIP text-encoder last_hidden_state, pooled at the EOS position.
text = vec2text.invert_embeddings(
embeddings=embeddings, # (batch, hidden_dim) on the same device as the model
corrector=corrector,
num_steps=20,
sequence_beam_width=1,
)
The CLIP text encoder is loaded automatically when the inversion model is instantiated.
On a clean machine it is fetched from openai/clip-vit-large-patch14; override with the
CLIP_TEXT_ENCODER environment variable if you want a local copy.