/ Модель

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

Контекст
512 токенов
Лицензия
Apache 2.0
Архитектура
vgcn-bert · dense
Опубликована
9 июн 2023

vgcn-bert-distilbert-base-uncased

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

Англоязычная модель VGCN-BERT на базе DistilBERT объединяет трансформерные представления с графом словаря и предназначена для извлечения признаков и дообучения под задачи обработки текста.

107скачиваний за 30 дней1лайквеса обновлены23 июн 2024

Бенчмарки

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

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

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

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

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

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

VGCN-BERT — модель на основе uncased-версии DistilBERT-base, разработанная автором репозитория zhibinlu и основанная на архитектуре из статьи VGCN-BERT. Она объединяет контекстные представления трансформера с графовой свёрточной сетью по графу словаря, чтобы совместно учитывать локальные связи в тексте и глобальные связи между словами. Модель предназначена прежде всего для дообучения под задачи классификации текста и другие задачи обработки английского текста; README также описывает способы построения графа на основе статистики совместной встречаемости или заданных связей сущностей.

В репозитории указаны задача извлечения признаков, контекст до 512 токенов и формат весов safetensors. Метаданные также перечисляют задачи заполнения пропусков, классификации текста, ответов на вопросы, разметки токенов и multiple choice. Автор сообщает об ускорении вычисления графовых эмбеддингов и приводит пример, где дополнительное время обучения для CoLA составляет 11% относительно базовой модели. Модель лицензирована по Apache-2.0. Автор отмечает, что статистически построенный граф словаря может давать ограниченное улучшение, а практический потенциал видит в интеграции пользовательских графов; модель рекомендуется дообучать для конкретной задачи.

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

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

Ограничения

Автор указывает, что граф словаря, построенный статистическими методами, может ограниченно улучшать качество; для конкретных задач рекомендуется дообучение. README не приводит количественных оценок качества для этого чекпойнта.

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

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

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

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

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

Открыть на Hugging Face

VGCN-BERT (DistilBERT based, uncased)

This model is a VGCN-BERT model based on DistilBert-base-uncased version. The original paper is VGCN-BERT.

Much progress has been made recently on text classification with methods based on neural networks. In particular, models using attention mechanism such as BERT have shown to have the capability of capturing the contextual information within a sentence or document. However, their ability of capturing the global information about the vocabulary of a language is more limited. This latter is the strength of Graph Convolutional Networks (GCN). In this paper, we propose VGCN-BERT model which combines the capability of BERT with a Vocabulary Graph Convolutional Network (VGCN). Local information and global information interact through different layers of BERT, allowing them to influence mutually and to build together a final representation for classification. In our experiments on several text classification datasets, our approach outperforms BERT and GCN alone, and achieve higher effectiveness than that reported in previous studies.

The original implementation is in my GitHub vgcn-bert repo, but recently I updated the algorithm and implemented this new version for integrating in HuggingFace Transformers, the new version has the following improvements:

  • Greatly speeds up the calculation speed of embedding vocabulary graph convolutinal network (or Word Graph embedding). Taking CoLa as an example, the new model only increases the training time by 11% compared with the base model
  • Updated subgraph selection algorithm.
  • Currently using DistilBert as the base model, but it is easy to migrate to other models.
  • Provide two graph construction methods in vgcn_bert/modeling_graph.py (the same NPMI statistical method as the paper, and the predefined entity-relationship mapping method)

I hope that after integrating into transformers, someone can discover some more practical use case and share to me. I am ashamed to say that I have not discovered too much real use cases myself, mainly because the word-grounded graph obtained through statistical methods has limited improvement on the LLM model. I think its potential application should be when there are specific/customized graphs that need to be integrated into LLM.

How to use

import transformers as tfr

# Use DistilBert tokenizer, that is corresponding to the base model of this version
tokenizer = tfr.AutoTokenizer.from_pretrained("distilbert-base-uncased")

# Load VGCN-BERT model
model = tfr.AutoModel.from_pretrained(
    "zhibinlu/vgcn-bert-distilbert-base-uncased", trust_remote_code=True,
    # # if you already have WordGraphs (torch sparse) and their id_maps,
    # # you can directly instantiate VGCN-BERT model with your WGraphs (support multiple graphs)
    # wgraphs=wgraph_list, 
    # wgraph_id_to_tokenizer_id_maps=id_map_list
)

# Generator WGraph symmetric adjacency matrix
# 1st method: Build graph using NPMI statistical method from training corpus
# wgraph, wgraph_id_to_tokenizer_id_map = model.wgraph_builder(rows=train_valid_df["text"], tokenizer=tokenizer)
# 2nd method: Build graph from pre-defined entity relationship tuple with weight
entity_relations = [
    ("dog", "labrador", 0.6),
    ("cat", "garfield", 0.7),
    ("city", "montreal", 0.8),
    ("weather", "rain", 0.3),
]
wgraph, wgraph_id_to_tokenizer_id_map = model.wgraph_builder(rows=entity_relations, tokenizer=tokenizer)

# Add WordGraphs to the model
model.set_wgraphs([wgraph], [wgraph_id_to_tokenizer_id_map])

text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors="pt")
output = model(**encoded_input)

Fine-tune model

It's better fin-tune vgcn-bert model for the specific tasks.

Citation

If you make use of this code or the VGCN-BERT approach in your work, please cite the following paper:

 @inproceedings{ZhibinluGraphEmbedding,
     author    = {Zhibin Lu and Pan Du and Jian-Yun Nie},
     title     = {VGCN-BERT: Augmenting BERT with Graph Embedding for Text Classification},
     booktitle = {Advances in Information Retrieval - 42nd European Conference on {IR}
                       Research, {ECIR} 2020, Lisbon, Portugal, April 14-17, 2020, Proceedings,
                       Part {I}},
     series    = {Lecture Notes in Computer Science},
     volume    = {12035},
     pages     = {369--382},
     publisher = {Springer},
     year      = {2020},
   }

License

VGCN-BERT is made available under the Apache 2.0 license.

Contact

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

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

GPU в ailist

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

Нельзя запустить

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
VGCNBertModel
Ревизия весов
3783fc5

0 моделей