Feature Extraction
sentence-transformers
Safetensors
English
Portuguese
lexical_embedding
custom_code
Instructions to use cnmoro/LexicalEmbed-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use cnmoro/LexicalEmbed-Base with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("cnmoro/LexicalEmbed-Base", 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
Update lexical_model.py
Browse files- lexical_model.py +0 -2
lexical_model.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
# file: lexical_model.py
|
| 2 |
import torch
|
| 3 |
import torch.nn as nn
|
| 4 |
from transformers import PreTrainedModel, PretrainedConfig
|
|
@@ -25,7 +24,6 @@ class LexicalHFModel(PreTrainedModel):
|
|
| 25 |
super().__init__(config)
|
| 26 |
self.config = config
|
| 27 |
|
| 28 |
-
# We use the exact name 'embedding' so it matches your .pth state_dict keys
|
| 29 |
self.embedding = nn.Embedding(
|
| 30 |
config.vocab_size,
|
| 31 |
config.embed_dim,
|
|
|
|
|
|
|
| 1 |
import torch
|
| 2 |
import torch.nn as nn
|
| 3 |
from transformers import PreTrainedModel, PretrainedConfig
|
|
|
|
| 24 |
super().__init__(config)
|
| 25 |
self.config = config
|
| 26 |
|
|
|
|
| 27 |
self.embedding = nn.Embedding(
|
| 28 |
config.vocab_size,
|
| 29 |
config.embed_dim,
|