Spaces:
Running
Running
Minor
Browse files
README.md
CHANGED
@@ -51,6 +51,7 @@ for score in results:
|
|
51 |
|
52 |
Sem-F1 also accepts multiple optional arguments:
|
53 |
|
|
|
54 |
- `model_type (str)`: Model to use for encoding sentences. Options: ['pv1', 'stsb', 'use']
|
55 |
|
56 |
- `pv1` - [paraphrase-distilroberta-base-v1](https://huggingface.co/sentence-transformers/paraphrase-distilroberta-base-v1)
|
|
|
51 |
|
52 |
Sem-F1 also accepts multiple optional arguments:
|
53 |
|
54 |
+
|
55 |
- `model_type (str)`: Model to use for encoding sentences. Options: ['pv1', 'stsb', 'use']
|
56 |
|
57 |
- `pv1` - [paraphrase-distilroberta-base-v1](https://huggingface.co/sentence-transformers/paraphrase-distilroberta-base-v1)
|
encoder_models.py
CHANGED
@@ -4,7 +4,7 @@ from typing import List, Union
|
|
4 |
from numpy.typing import NDArray
|
5 |
from sentence_transformers import SentenceTransformer
|
6 |
|
7 |
-
from type_aliases import ENCODER_DEVICE_TYPE
|
8 |
|
9 |
|
10 |
class Encoder(abc.ABC):
|
|
|
4 |
from numpy.typing import NDArray
|
5 |
from sentence_transformers import SentenceTransformer
|
6 |
|
7 |
+
from .type_aliases import ENCODER_DEVICE_TYPE
|
8 |
|
9 |
|
10 |
class Encoder(abc.ABC):
|
semf1.py
CHANGED
@@ -23,9 +23,9 @@ import numpy as np
|
|
23 |
from numpy.typing import NDArray
|
24 |
from sklearn.metrics.pairwise import cosine_similarity
|
25 |
|
26 |
-
from encoder_models import get_encoder
|
27 |
-
from type_aliases import DEVICE_TYPE, PREDICTION_TYPE, REFERENCE_TYPE
|
28 |
-
from utils import is_nested_list_of_type, Scores, slice_embeddings, flatten_list, get_gpu
|
29 |
|
30 |
_CITATION = """\
|
31 |
@inproceedings{bansal-etal-2022-sem,
|
@@ -410,3 +410,4 @@ class SemF1(evaluate.Metric):
|
|
410 |
results.append(Scores(precision, recall_scores))
|
411 |
|
412 |
return results
|
|
|
|
23 |
from numpy.typing import NDArray
|
24 |
from sklearn.metrics.pairwise import cosine_similarity
|
25 |
|
26 |
+
from .encoder_models import get_encoder
|
27 |
+
from .type_aliases import DEVICE_TYPE, PREDICTION_TYPE, REFERENCE_TYPE
|
28 |
+
from .utils import is_nested_list_of_type, Scores, slice_embeddings, flatten_list, get_gpu
|
29 |
|
30 |
_CITATION = """\
|
31 |
@inproceedings{bansal-etal-2022-sem,
|
|
|
410 |
results.append(Scores(precision, recall_scores))
|
411 |
|
412 |
return results
|
413 |
+
|
utils.py
CHANGED
@@ -6,7 +6,7 @@ from typing import List, Union
|
|
6 |
import torch
|
7 |
from numpy.typing import NDArray
|
8 |
|
9 |
-
from type_aliases import DEVICE_TYPE, ENCODER_DEVICE_TYPE, NumSentencesType, EmbeddingSlicesType
|
10 |
|
11 |
|
12 |
def get_gpu(gpu: DEVICE_TYPE) -> ENCODER_DEVICE_TYPE:
|
|
|
6 |
import torch
|
7 |
from numpy.typing import NDArray
|
8 |
|
9 |
+
from .type_aliases import DEVICE_TYPE, ENCODER_DEVICE_TYPE, NumSentencesType, EmbeddingSlicesType
|
10 |
|
11 |
|
12 |
def get_gpu(gpu: DEVICE_TYPE) -> ENCODER_DEVICE_TYPE:
|