Sentence Similarity
sentence-transformers
ONNX
Safetensors
English
modernbert
feature-extraction
text-retrieval
scientific-papers
literature-search
arxiv
Eval Results (legacy)
text-embeddings-inference
Instructions to use daniel-gomm/scientific-granite with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use daniel-gomm/scientific-granite with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("daniel-gomm/scientific-granite") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Download deploy/compose.vllm.yml from daniel-gomm/scientific-granite: direct link, hf CLI and curl.
- Browser
- Download file 1.88 kB
-
https://huggingface.co/daniel-gomm/scientific-granite/resolve/main/deploy/compose.vllm.yml
- Command line
-
hf download hf://daniel-gomm/scientific-granite/deploy/compose.vllm.yml
-
curl -L -o compose.vllm.yml https://huggingface.co/daniel-gomm/scientific-granite/resolve/main/deploy/compose.vllm.yml
1.88 kB
| # Serve scientific_granite with vLLM (OpenAI-compatible /v1/embeddings). | |
| # | |
| # docker compose -f compose.vllm.yml up -d # needs an NVIDIA GPU + NVIDIA Container Toolkit | |
| # | |
| # Then: | |
| # curl localhost:8000/v1/embeddings -H 'Content-Type: application/json' \ | |
| # -d '{"model": "daniel-gomm/scientific_granite", "input": ["your query"]}' | |
| # | |
| # vLLM returns unnormalized embeddings for this model: L2-normalize before dot-product | |
| # similarity (cosine is unaffected). GPU memory: ~0.5 GB; the model needs no KV cache, so a | |
| # small --gpu-memory-utilization leaves the rest of the GPU free. | |
| name: scientific-granite-vllm | |
| services: | |
| vllm: | |
| build: | |
| # orjson makes vLLM's /v1/embeddings JSON encoding much faster (vLLM warns without it) | |
| dockerfile_inline: | | |
| FROM vllm/vllm-openai:${VLLM_VERSION:-v0.31.0} | |
| RUN pip install --no-cache-dir orjson | |
| image: scientific-granite-vllm:${VLLM_VERSION:-v0.31.0} | |
| entrypoint: ["vllm", "serve"] | |
| command: >- | |
| ${MODEL_ID:-daniel-gomm/scientific_granite} | |
| --runner pooling | |
| --pooler-config '{"pooling_type": "CLS"}' | |
| --max-model-len 2048 | |
| --gpu-memory-utilization ${GPU_MEM_UTIL:-0.25} | |
| --disable-uvicorn-access-log | |
| ports: | |
| - "${PORT:-8000}:8000" | |
| ipc: host | |
| volumes: | |
| - hf-cache:/root/.cache/huggingface # downloaded model files | |
| - vllm-cache:/root/.cache/vllm # torch.compile artifacts: faster restarts | |
| environment: | |
| HF_TOKEN: ${HF_TOKEN:-} | |
| healthcheck: | |
| test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] | |
| interval: 10s | |
| start_period: 120s | |
| restart: unless-stopped | |
| deploy: | |
| resources: | |
| reservations: | |
| devices: | |
| - driver: nvidia | |
| count: 1 | |
| capabilities: [gpu] | |
| volumes: | |
| hf-cache: | |
| vllm-cache: | |