Feature Extraction
sentence-transformers
Safetensors
Chinese
bert
mteb
Eval Results (legacy)
text-embeddings-inference
Instructions to use OpenSearch-AI/Ops-MoA-Yuan-embedding-1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use OpenSearch-AI/Ops-MoA-Yuan-embedding-1.0 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("OpenSearch-AI/Ops-MoA-Yuan-embedding-1.0") 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
change to class method
Browse files- modeling_adaptor.py +3 -3
modeling_adaptor.py
CHANGED
|
@@ -89,12 +89,12 @@ class MixtureOfAdaptors(nn.Module):
|
|
| 89 |
)
|
| 90 |
return adaptor_cache
|
| 91 |
|
| 92 |
-
@
|
| 93 |
-
def load(input_path):
|
| 94 |
with open(os.path.join(input_path, "config.json")) as fIn:
|
| 95 |
config = json.load(fIn)
|
| 96 |
|
| 97 |
-
adaptor =
|
| 98 |
adaptor.load_state_dict(
|
| 99 |
torch.load(
|
| 100 |
os.path.join(input_path, "adaptor.pth"), weights_only=True
|
|
|
|
| 89 |
)
|
| 90 |
return adaptor_cache
|
| 91 |
|
| 92 |
+
@classmethod
|
| 93 |
+
def load(cls, input_path):
|
| 94 |
with open(os.path.join(input_path, "config.json")) as fIn:
|
| 95 |
config = json.load(fIn)
|
| 96 |
|
| 97 |
+
adaptor = cls(**config)
|
| 98 |
adaptor.load_state_dict(
|
| 99 |
torch.load(
|
| 100 |
os.path.join(input_path, "adaptor.pth"), weights_only=True
|