VoVanPhuc / sup-SimCSE-VietNamese-phobert-base

huggingface.co
Total runs: 199.9K
24-hour runs: -7.4K
7-day runs: -37.2K
30-day runs: -219.6K
Model's Last Updated: April 10 2024
sentence-similarity

Introduction of sup-SimCSE-VietNamese-phobert-base

Model Details of sup-SimCSE-VietNamese-phobert-base

Table of contents
  1. Introduction
  2. Pretrain model
  3. Using SimeCSE_Vietnamese with sentences-transformers
  4. Using SimeCSE_Vietnamese with transformers

SimeCSE_Vietnamese: Simple Contrastive Learning of Sentence Embeddings with Vietnamese

Pre-trained SimeCSE_Vietnamese models are the state-of-the-art of Sentence Embeddings with Vietnamese :

  • SimeCSE_Vietnamese pre-training approach is based on SimCSE which optimizes the SimeCSE_Vietnamese pre-training procedure for more robust performance.
  • SimeCSE_Vietnamese encode input sentences using a pre-trained language model such as PhoBert
  • SimeCSE_Vietnamese works with both unlabeled and labeled data.
Pre-trained models
Using SimeCSE_Vietnamese with sentences-transformers
Installation
  • Install sentence-transformers :

    • pip install -U sentence-transformers
  • Install pyvi to word segment:

    • pip install pyvi
Example usage
from sentence_transformers import SentenceTransformer
from pyvi.ViTokenizer import tokenize

model = SentenceTransformer('VoVanPhuc/sup-SimCSE-VietNamese-phobert-base')

sentences = ['Kẻ đánh bom đinh tồi tệ nhất nước Anh.',
          'Nghệ sĩ làm thiện nguyện - minh bạch là việc cấp thiết.',
          'Bắc Giang tăng khả năng điều trị và xét nghiệm.',
          'HLV futsal Việt Nam tiết lộ lý do hạ Lebanon.',
          'việc quan trọng khi kêu gọi quyên góp từ thiện là phải minh bạch, giải ngân kịp thời.',
          '20% bệnh nhân Covid-19 có thể nhanh chóng trở nặng.',
          'Thái Lan thua giao hữu trước vòng loại World Cup.',
          'Cựu tuyển thủ Nguyễn Bảo Quân: May mắn ủng hộ futsal Việt Nam',
          'Chủ ki-ốt bị đâm chết trong chợ đầu mối lớn nhất Thanh Hoá.',
          'Bắn chết người trong cuộc rượt đuổi trên sông.'
          ]

sentences = [tokenize(sentence) for sentence in sentences]
embeddings = model.encode(sentences)
Using SimeCSE_Vietnamese with transformers
Installation
  • Install transformers :

    • pip install -U transformers
  • Install pyvi to word segment:

    • pip install pyvi
Example usage
import torch
from transformers import AutoModel, AutoTokenizer
from pyvi.ViTokenizer import tokenize

PhobertTokenizer = AutoTokenizer.from_pretrained("VoVanPhuc/sup-SimCSE-VietNamese-phobert-base")
model = AutoModel.from_pretrained("VoVanPhuc/sup-SimCSE-VietNamese-phobert-base")

sentences = ['Kẻ đánh bom đinh tồi tệ nhất nước Anh.',
          'Nghệ sĩ làm thiện nguyện - minh bạch là việc cấp thiết.',
          'Bắc Giang tăng khả năng điều trị và xét nghiệm.',
          'HLV futsal Việt Nam tiết lộ lý do hạ Lebanon.',
          'việc quan trọng khi kêu gọi quyên góp từ thiện là phải minh bạch, giải ngân kịp thời.',
          '20% bệnh nhân Covid-19 có thể nhanh chóng trở nặng.',
          'Thái Lan thua giao hữu trước vòng loại World Cup.',
          'Cựu tuyển thủ Nguyễn Bảo Quân: May mắn ủng hộ futsal Việt Nam',
          'Chủ ki-ốt bị đâm chết trong chợ đầu mối lớn nhất Thanh Hoá.',
          'Bắn chết người trong cuộc rượt đuổi trên sông.'
          ]

sentences = [tokenize(sentence) for sentence in sentences]

inputs = PhobertTokenizer(sentences, padding=True, truncation=True, return_tensors="pt")

with torch.no_grad():
    embeddings = model(**inputs, output_hidden_states=True, return_dict=True).pooler_output
Quick Start

Open In Colab

Citation
@article{gao2021simcse,
   title={{SimCSE}: Simple Contrastive Learning of Sentence Embeddings},
   author={Gao, Tianyu and Yao, Xingcheng and Chen, Danqi},
   journal={arXiv preprint arXiv:2104.08821},
   year={2021}
}

@inproceedings{phobert,
title     = {{PhoBERT: Pre-trained language models for Vietnamese}},
author    = {Dat Quoc Nguyen and Anh Tuan Nguyen},
booktitle = {Findings of the Association for Computational Linguistics: EMNLP 2020},
year      = {2020},
pages     = {1037--1042}
}

Runs of VoVanPhuc sup-SimCSE-VietNamese-phobert-base on huggingface.co

199.9K
Total runs
-7.4K
24-hour runs
-18.8K
3-day runs
-37.2K
7-day runs
-219.6K
30-day runs

More Information About sup-SimCSE-VietNamese-phobert-base huggingface.co Model

sup-SimCSE-VietNamese-phobert-base huggingface.co

sup-SimCSE-VietNamese-phobert-base huggingface.co is an AI model on huggingface.co that provides sup-SimCSE-VietNamese-phobert-base's model effect (), which can be used instantly with this VoVanPhuc sup-SimCSE-VietNamese-phobert-base model. huggingface.co supports a free trial of the sup-SimCSE-VietNamese-phobert-base model, and also provides paid use of the sup-SimCSE-VietNamese-phobert-base. Support call sup-SimCSE-VietNamese-phobert-base model through api, including Node.js, Python, http.

sup-SimCSE-VietNamese-phobert-base huggingface.co Url

https://huggingface.co/VoVanPhuc/sup-SimCSE-VietNamese-phobert-base

VoVanPhuc sup-SimCSE-VietNamese-phobert-base online free

sup-SimCSE-VietNamese-phobert-base huggingface.co is an online trial and call api platform, which integrates sup-SimCSE-VietNamese-phobert-base's modeling effects, including api services, and provides a free online trial of sup-SimCSE-VietNamese-phobert-base, you can try sup-SimCSE-VietNamese-phobert-base online for free by clicking the link below.

VoVanPhuc sup-SimCSE-VietNamese-phobert-base online free url in huggingface.co:

https://huggingface.co/VoVanPhuc/sup-SimCSE-VietNamese-phobert-base

sup-SimCSE-VietNamese-phobert-base install

sup-SimCSE-VietNamese-phobert-base is an open source model from GitHub that offers a free installation service, and any user can find sup-SimCSE-VietNamese-phobert-base on GitHub to install. At the same time, huggingface.co provides the effect of sup-SimCSE-VietNamese-phobert-base install, users can directly use sup-SimCSE-VietNamese-phobert-base installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

sup-SimCSE-VietNamese-phobert-base install url in huggingface.co:

https://huggingface.co/VoVanPhuc/sup-SimCSE-VietNamese-phobert-base

Url of sup-SimCSE-VietNamese-phobert-base

sup-SimCSE-VietNamese-phobert-base huggingface.co Url

Provider of sup-SimCSE-VietNamese-phobert-base huggingface.co

VoVanPhuc
ORGANIZATIONS

Other API from VoVanPhuc