Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
this is the placeholder model card for the (finess-benchmark-space)[https://huggingface.co/spaces/enzoescipy/finesse-benchmark-space] and its (database)[https://huggingface.co/datasets/enzoescipy/finesse-benchmark-results].
|
| 5 |
+
|
| 6 |
+
```python
|
| 7 |
+
import torch
|
| 8 |
+
from typing import List
|
| 9 |
+
from transformers import AutoConfig, PreTrainedModel # Optional: for loading configs
|
| 10 |
+
|
| 11 |
+
from finesse_benchmark.interfaces import FinesseSynthesizer
|
| 12 |
+
|
| 13 |
+
# --- Custom Embedder Example ---
|
| 14 |
+
# Uncomment and customize this class for your embedder.
|
| 15 |
+
|
| 16 |
+
class AverageSynthesizer(FinesseSynthesizer):
|
| 17 |
+
"""
|
| 18 |
+
Average Synthesizer: Computes the mean of input embeddings without using any model.
|
| 19 |
+
"""
|
| 20 |
+
def __init__(self, config_path: str):
|
| 21 |
+
super().__init__()
|
| 22 |
+
# No model to load for average pooling
|
| 23 |
+
print(f"{self.__class__.__name__} initialized - Average pooling ready.")
|
| 24 |
+
|
| 25 |
+
def synthesize(self, embeddings: torch.Tensor, **kwargs) -> torch.Tensor:
|
| 26 |
+
"""
|
| 27 |
+
Average synthesis: Compute the mean along the sequence dimension.
|
| 28 |
+
|
| 29 |
+
Args:
|
| 30 |
+
embeddings: torch.Tensor of shape (batch, seq_len, embedding_dim)
|
| 31 |
+
**kwargs: Additional arguments
|
| 32 |
+
|
| 33 |
+
Returns:
|
| 34 |
+
torch.Tensor of shape (batch, embedding_dim)
|
| 35 |
+
"""
|
| 36 |
+
return embeddings.mean(dim=1)
|
| 37 |
+
|
| 38 |
+
def device(self):
|
| 39 |
+
return "cpu"
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
it just averages the embedding vectors.
|