sentence-transformers
Safetensors
English
nomic_bert
flash-attention
code-retrieval
nomic-bert
bf16
custom_code
Instructions to use handwoven8588/CodeRankEmbed-flash-attn with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use handwoven8588/CodeRankEmbed-flash-attn with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("handwoven8588/CodeRankEmbed-flash-attn", trust_remote_code=True) sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Card: table generated from idle-bracketed gate runs at 1954de4; state what encode peak measures and how much wall time varies
Browse files
README.md
CHANGED
|
@@ -107,26 +107,36 @@ against the **pre-dispatch revision of this repo on the same GPU** (its `flash_a
|
|
| 107 |
`flash_attn` runs the same computation as before the dispatch, so its cosine is a parity check.
|
| 108 |
`torch_varlen` is a different, torch-native kernel, and `eager` a different algorithm, so theirs
|
| 109 |
are the real signal. `auto` is the default with no override: the probe keeps `torch_varlen`.
|
| 110 |
-
**Encode peak** is the encode's peak CUDA allocation above the loaded model
|
| 111 |
-
bf16 weights
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
| GPU | batch size | tier | mean cos | min cos | encode peak | wall |
|
| 114 |
| --- | --- | --- | --- | --- | --- | --- |
|
| 115 |
-
| RTX 3090 Ti (sm_86) | 32 | `torch_varlen` | 0.999941 | 0.999856 | 600 MiB | 0.
|
| 116 |
-
| RTX 3090 Ti (sm_86) | 32 | `flash_attn` | 1.000000 | 1.000000 | 600 MiB | 0.
|
| 117 |
-
| RTX 3090 Ti (sm_86) | 32 | `eager` | 0.999912 | 0.999856 | 807 MiB | 0.
|
| 118 |
-
| RTX 3090 Ti (sm_86) |
|
| 119 |
-
| RTX 3090 Ti (sm_86) | 64 | `
|
| 120 |
-
| RTX 3090 Ti (sm_86) | 64 | `
|
| 121 |
-
| RTX
|
| 122 |
-
| RTX
|
|
|
|
|
|
|
| 123 |
| RTX 5090 Laptop GPU (sm_120) | 32 | `eager` | 0.999912 | 0.999870 | 807 MiB | 0.318 s |
|
| 124 |
-
| RTX 5090 Laptop GPU (sm_120) |
|
| 125 |
-
| RTX 5090 Laptop GPU (sm_120) | 64 | `
|
| 126 |
-
| RTX 5090 Laptop GPU (sm_120) | 64 | `
|
|
|
|
|
|
|
| 127 |
|
| 128 |
Cosines rounded to 6 decimal places, VRAM to the nearest MiB. `torch 2.12.1+cu130`,
|
| 129 |
-
`transformers 5.11.0`, `sentence-transformers 6.1.0`, `flash-attn 2.8.3`.
|
|
|
|
|
|
|
| 130 |
|
| 131 |
Eager's cost grows with `batch × heads × seq²`: at these short snippets it needs about a third more
|
| 132 |
encode memory than the varlen tiers. At longer inputs the gap stops being a percentage. At a
|
|
|
|
| 107 |
`flash_attn` runs the same computation as before the dispatch, so its cosine is a parity check.
|
| 108 |
`torch_varlen` is a different, torch-native kernel, and `eager` a different algorithm, so theirs
|
| 109 |
are the real signal. `auto` is the default with no override: the probe keeps `torch_varlen`.
|
| 110 |
+
**Encode peak** is the encode's peak CUDA allocation above what the loaded model holds (266 MiB
|
| 111 |
+
of bf16 weights; the first model loaded in a process also holds cuBLAS's workspace, 8 MiB on sm_86
|
| 112 |
+
and 32 MiB on sm_120). Each tier loads and frees its own model, so no reading includes another
|
| 113 |
+
tier's weights. Wall time is one encode of all 64 snippets. Cosines and VRAM repeated exactly
|
| 114 |
+
across every run; wall time moved by up to ~15% between runs, so read it as indicative.
|
| 115 |
+
Every row was measured loading this repo at commit `1954de4`.
|
| 116 |
|
| 117 |
| GPU | batch size | tier | mean cos | min cos | encode peak | wall |
|
| 118 |
| --- | --- | --- | --- | --- | --- | --- |
|
| 119 |
+
| RTX 3090 Ti (sm_86) | 32 | `torch_varlen` | 0.999941 | 0.999856 | 600 MiB | 0.197 s |
|
| 120 |
+
| RTX 3090 Ti (sm_86) | 32 | `flash_attn` | 1.000000 | 1.000000 | 600 MiB | 0.197 s |
|
| 121 |
+
| RTX 3090 Ti (sm_86) | 32 | `eager` | 0.999912 | 0.999856 | 807 MiB | 0.262 s |
|
| 122 |
+
| RTX 3090 Ti (sm_86) | 32 | `auto` (→ `torch_varlen`) | 0.999941 | 0.999856 | 600 MiB | 0.197 s |
|
| 123 |
+
| RTX 3090 Ti (sm_86) | 64 | `torch_varlen` | 0.999941 | 0.999856 | 1201 MiB | 0.223 s |
|
| 124 |
+
| RTX 3090 Ti (sm_86) | 64 | `flash_attn` | 1.000000 | 1.000000 | 1201 MiB | 0.218 s |
|
| 125 |
+
| RTX 3090 Ti (sm_86) | 64 | `eager` | 0.999910 | 0.999856 | 1614 MiB | 0.302 s |
|
| 126 |
+
| RTX 3090 Ti (sm_86) | 64 | `auto` (→ `torch_varlen`) | 0.999941 | 0.999856 | 1201 MiB | 0.218 s |
|
| 127 |
+
| RTX 5090 Laptop GPU (sm_120) | 32 | `torch_varlen` | 0.999944 | 0.999919 | 600 MiB | 0.235 s |
|
| 128 |
+
| RTX 5090 Laptop GPU (sm_120) | 32 | `flash_attn` | 1.000000 | 1.000000 | 600 MiB | 0.234 s |
|
| 129 |
| RTX 5090 Laptop GPU (sm_120) | 32 | `eager` | 0.999912 | 0.999870 | 807 MiB | 0.318 s |
|
| 130 |
+
| RTX 5090 Laptop GPU (sm_120) | 32 | `auto` (→ `torch_varlen`) | 0.999944 | 0.999919 | 600 MiB | 0.235 s |
|
| 131 |
+
| RTX 5090 Laptop GPU (sm_120) | 64 | `torch_varlen` | 0.999944 | 0.999919 | 1201 MiB | 0.271 s |
|
| 132 |
+
| RTX 5090 Laptop GPU (sm_120) | 64 | `flash_attn` | 1.000000 | 1.000000 | 1201 MiB | 0.273 s |
|
| 133 |
+
| RTX 5090 Laptop GPU (sm_120) | 64 | `eager` | 0.999913 | 0.999834 | 1614 MiB | 0.377 s |
|
| 134 |
+
| RTX 5090 Laptop GPU (sm_120) | 64 | `auto` (→ `torch_varlen`) | 0.999944 | 0.999919 | 1201 MiB | 0.274 s |
|
| 135 |
|
| 136 |
Cosines rounded to 6 decimal places, VRAM to the nearest MiB. `torch 2.12.1+cu130`,
|
| 137 |
+
`transformers 5.11.0`, `sentence-transformers 6.1.0`, `flash-attn 2.8.3` (`2.8.3.post1` on the 3090 Ti host).
|
| 138 |
+
Each run held the hosts' shared GPU lock, with the card idle (0% util, no foreign process)
|
| 139 |
+
before and after.
|
| 140 |
|
| 141 |
Eager's cost grows with `batch × heads × seq²`: at these short snippets it needs about a third more
|
| 142 |
encode memory than the varlen tiers. At longer inputs the gap stops being a percentage. At a
|