/ Модель

Характеристики

Контекст
258 токенов
Параметры
162 млн
Лицензия
AGPL 3.0
Архитектура
roberta · dense
Опубликована
24 апр 2023

phobert-base-v2

Заполнение пропусковТекст → текст3 профессии

PhoBERT-base-v2 — вьетнамский RoBERTa-энкодер для заполнения пропусков и адаптации к задачам обработки вьетнамского языка.

64 510скачиваний за 30 дней32лайкавеса обновлены3 авг 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

PhoBERT-base-v2 — монолингвальная языковая модель для вьетнамского языка, разработанная Dat Quoc Nguyen и Anh Tuan Nguyen. Это энкодер на архитектуре RoBERTa с примерно 162,4 млн параметров; он предобучен на маскированном языковом моделировании на вьетнамской Википедии, новостных текстах и корпусе OSCAR-2301. Максимальная длина контекста — 258 токенов.

Модель предназначена для заполнения пропусков в тексте и служит основой для адаптации к задачам обработки вьетнамского языка, включая разметку частей речи, синтаксический анализ зависимостей, распознавание именованных сущностей и вывод на естественном языке. Для подачи необработанного вьетнамского текста README рекомендует предварительную сегментацию слов с помощью RDRSegmenter из VnCoreNLP, а также нормализацию тонов и сегментацию предложений. Модель выпущена по лицензии AGPL-3.0.

Сценарии применения

  • заполнение скрытых слов во вьетнамском тексте
  • дообучение для распознавания именованных сущностей на вьетнамском
  • дообучение для разметки частей речи во вьетнамском
  • дообучение для синтаксического анализа вьетнамских предложений
  • дообучение для определения смыслового вывода во вьетнамском

Ограничения

Для необработанного вьетнамского текста требуется предварительная сегментация слов; README рекомендует RDRSegmenter из VnCoreNLP. Контекст ограничен 258 токенами.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Table of contents

  1. Introduction
  2. Using PhoBERT with transformers
  3. Using PhoBERT with fairseq
  4. Notes

PhoBERT: Pre-trained language models for Vietnamese

Pre-trained PhoBERT models are the state-of-the-art language models for Vietnamese (Pho, i.e. "Phở", is a popular food in Vietnam):

  • Two PhoBERT versions of "base" and "large" are the first public large-scale monolingual language models pre-trained for Vietnamese. PhoBERT pre-training approach is based on RoBERTa which optimizes the BERT pre-training procedure for more robust performance.
  • PhoBERT outperforms previous monolingual and multilingual approaches, obtaining new state-of-the-art performances on four downstream Vietnamese NLP tasks of Part-of-speech tagging, Dependency parsing, Named-entity recognition and Natural language inference.

The general architecture and experimental results of PhoBERT can be found in our paper:

@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}
}

Please CITE our paper when PhoBERT is used to help produce published results or is incorporated into other software.

Users may also want to use BamiBERT, our new BERT-based pretrained language model for Vietnamese that addresses key limitations of PhoBERT. Trained from scratch on a 129 GB corpus of general-domain Vietnamese text for 20 epochs, BamiBERT supports an extended context length of up to 2,048 tokens and operates directly on raw input, eliminating the need for external word segmentation. Across eight Vietnamese benchmarks, it achieves the best performance on 11 of 15 metrics and the second-best performance on three others, setting a new state of the art among "base"-sized Vietnamese encoders and demonstrating strong cross-domain generalization.

Using PhoBERT with transformers

Installation

  • Install transformers with pip: pip install transformers, or install transformers from source. Note that we merged a slow tokenizer for PhoBERT into the main transformers branch. The process of merging a fast tokenizer for PhoBERT is in the discussion, as mentioned in this pull request. If users would like to utilize the fast tokenizer, the users might install transformers as follows:
git clone --single-branch --branch fast_tokenizers_BARTpho_PhoBERT_BERTweet https://github.com/datquocnguyen/transformers.git
cd transformers
pip3 install -e .
  • Install tokenizers with pip: pip3 install tokenizers

Pre-trained models

Model#paramsArch.Max lengthPre-training data
vinai/phobert-base135Mbase25620GB of Wikipedia and News texts
vinai/phobert-large370Mlarge25620GB of Wikipedia and News texts
vinai/phobert-base-v2135Mbase25620GB of Wikipedia and News texts + 120GB of texts from OSCAR-2301

Example usage

import torch
from transformers import AutoModel, AutoTokenizer

phobert = AutoModel.from_pretrained("vinai/phobert-base-v2")
tokenizer = AutoTokenizer.from_pretrained("vinai/phobert-base-v2")

# INPUT TEXT MUST BE ALREADY WORD-SEGMENTED!
sentence = 'Chúng_tôi là những nghiên_cứu_viên .'  

input_ids = torch.tensor([tokenizer.encode(sentence)])

with torch.no_grad():
    features = phobert(input_ids)  # Models outputs are now tuples

## With TensorFlow 2.0+:
# from transformers import TFAutoModel
# phobert = TFAutoModel.from_pretrained("vinai/phobert-base")

Using PhoBERT with fairseq

Please see details at HERE!

Notes

In case the input texts are raw, i.e. without word segmentation, a word segmenter must be applied to produce word-segmented texts before feeding to PhoBERT. As PhoBERT employed the RDRSegmenter from VnCoreNLP to pre-process the pre-training data (including Vietnamese tone normalization and word and sentence segmentation), it is recommended to also use the same word segmenter for PhoBERT-based downstream applications w.r.t. the input raw texts.

Installation

pip install py_vncorenlp

Example usage

import py_vncorenlp

# Automatically download VnCoreNLP components from the original repository
# and save them in some local machine folder
py_vncorenlp.download_model(save_dir='/absolute/path/to/vncorenlp')

# Load the word and sentence segmentation component
rdrsegmenter = py_vncorenlp.VnCoreNLP(annotators=["wseg"], save_dir='/absolute/path/to/vncorenlp')

text = "Ông Nguyễn Khắc Chúc  đang làm việc tại Đại học Quốc gia Hà Nội. Bà Lan, vợ ông Chúc, cũng làm việc tại đây."

output = rdrsegmenter.word_segment(text)

print(output)
# ['Ông Nguyễn_Khắc_Chúc đang làm_việc tại Đại_học Quốc_gia Hà_Nội .', 'Bà Lan , vợ ông Chúc , cũng làm_việc tại đây .']

License

Copyright (c) 2023 VinAI Research

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · fill-mask

Можно запустить

Подбираем GPU…

Класс архитектуры
RobertaForMaskedLM
Ревизия весов
86cd7fd

0 моделей