Feature Extraction
Transformers
PyTorch
Vietnamese
xlm-roberta
vietnamese
contrastive-learning
sentence-embedding
natural-language-inference
low-resource
nlu
Instructions to use huynhtin/ViCLSR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use huynhtin/ViCLSR with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="huynhtin/ViCLSR")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, XLMRobertaForCL tokenizer = AutoTokenizer.from_pretrained("huynhtin/ViCLSR") model = XLMRobertaForCL.from_pretrained("huynhtin/ViCLSR", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -147,9 +147,9 @@ def get_embedding(text):
|
|
| 147 |
embedding = outputs.last_hidden_state[:, 0]
|
| 148 |
return F.normalize(embedding, dim=-1)
|
| 149 |
|
| 150 |
-
sentence1 = "
|
| 151 |
-
sentence2 = "
|
| 152 |
-
sentence3 = "
|
| 153 |
|
| 154 |
emb1 = get_embedding(sentence1)
|
| 155 |
emb2 = get_embedding(sentence2)
|
|
|
|
| 147 |
embedding = outputs.last_hidden_state[:, 0]
|
| 148 |
return F.normalize(embedding, dim=-1)
|
| 149 |
|
| 150 |
+
sentence1 = "Hà Nội là thủ đô của Việt Nam."
|
| 151 |
+
sentence2 = "Thành phố Hà Nội là thủ đô nước Việt Nam."
|
| 152 |
+
sentence3 = "Bóng đá là môn thể thao phổ biến nhất thế giới."
|
| 153 |
|
| 154 |
emb1 = get_embedding(sentence1)
|
| 155 |
emb2 = get_embedding(sentence2)
|