Instructions to use OPI-PIB/PolDense-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use OPI-PIB/PolDense-1B with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("OPI-PIB/PolDense-1B") sentences = [ "zapytanie: Jak dożyć 100 lat?", "Trzeba zdrowo się odżywiać i uprawiać sport.", "Trzeba pić alkohol, imprezować i jeździć szybkimi autami.", "Gdy trwała kampania politycy zapewniali, że rozprawią się z zakazem niedzielnego handlu." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Transformers
How to use OPI-PIB/PolDense-1B with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("OPI-PIB/PolDense-1B") model = AutoModel.from_pretrained("OPI-PIB/PolDense-1B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
config_sentence_transformers.json: empty "query" prompt (400M/150M/68M have "[query]: ")
Hi,
thanks for releasing the PolDense family!
It looks like config_sentence_transformers.json in PolDense-1B is missing the query prompt that the README and the smaller models use:
| model | prompts in config_sentence_transformers.json |
|---|---|
| PolDense-1B | {"query": "", "document": ""} |
| PolDense-400M | {"query": "[query]: ", "document": ""} |
| PolDense-150M | {"query": "[query]: ", "document": ""} |
| PolDense-68M | {"query": "[query]: ", "document": ""} |
The README says retrieval queries should be prefixed with "[query]: ". With the current 1B config, anything that relies on the configured prompt silently embeds queries without the prefix. That covers model.encode(..., prompt_name="query"), encode_query() in sentence-transformers and tools that read the prompts from the config, such as MTEB.
Minimal check:
from sentence_transformers import SentenceTransformer
m = SentenceTransformer("OPI-PIB/PolDense-1B")
print(m.prompts) # {'query': '', 'document': ''}
Impact in our tests: on a PolQA sample, hit@1 was 0.52 without the prefix vs 0.81 with "[query]: " added manually. On our own Polish notes, the correct note reached the top 5 in 6/25 queries vs 18/25. The result was the same in fp32/fp16/bf16, on ROCm and CUDA, and in a GGUF conversion with llama.cpp, so the issue is only the missing prefix.
Suggested fix: set "query": "[query]: " in config_sentence_transformers.json (and possibly add "sts": "[sts]: " as described in the README).
Thanks for noticing, fixed.
Thanks for the quick fix!
FYI, in case it's useful: I published GGUF conversions of the whole PolDense family for llama.cpp
(F16 and Q8_0): https://huggingface.co/kprzyb/PolDense-1B-GGUF
(17M, 32M, 68M, 150M and 400M are under the same naming).
Each file was checked against sentence-transformers (fp32). Cosine similarity is ≥ 0.9996 for F16
and ≥ 0.9985 for Q8_0, including a 3k-token input. The cards cover two pitfalls for llama.cpp users:
the [query]: prefix has to be added manually, and the whole input must fit in one micro-batch (-ub).
Feel free to link them from your model cards, and let me know if you'd rather publish official GGUFs yourselves.