Safetensor keys differ with mistralai/Mistral-7B-v0.1

#23
by functorism - opened

Hello, perhaps I'm missing something obvious. But the keys in: https://huggingface.co/intfloat/e5-mistral-7b-instruct/blob/main/model.safetensors.index.json

Differ from most other mistral models, like https://huggingface.co/mistralai/Mistral-7B-v0.1/blob/main/model.safetensors.index.json

This is not an issue in python transformers, but causes an issue in Candle. Which assumes all keys are prefixed with model: https://github.com/huggingface/candle/blob/main/candle-transformers/src/models/mistral.rs#L384

This is an issue that should be solved in Candle, but I'm simply curious as to why this differs in the first place?

functorism changed discussion status to closed
functorism changed discussion status to open

This is expected.

The difference is caused by the lack of LM head for embedding models. For text generation models, one loads with AutoModelForCausalLM.from_pretrained(...), while for this embedding model, one should load with AutoModel.from_pretrained(...).

That makes sense. I've created a PR that addresses this for loading Mistral in Candle: https://github.com/huggingface/candle/pull/1636

functorism changed discussion status to closed

Sign up or log in to comment