/ Модель

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

Контекст
512 токенов
Параметры
25,9 млн
Архитектура
bert · dense
Базовая модель
all-MiniLM-L6-v2
Библиотека
setfit
Опубликована
29 янв 2024

setfit-absa-all-MiniLM-L6-v2-laptops-aspect

Классификация текстаТекст → label3 профессии

Англоязычная модель SetFit фильтрует кандидатов аспектов в отзывах о ноутбуках для систем анализа тональности по аспектам.

19скачиваний за 30 дней6лайковвеса обновлены29 янв 2024

Бенчмарки

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

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

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

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

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

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

Это англоязычная модель SetFit, разработанная joshuasundance для фильтрации кандидатов аспектов в системе анализа тональности по аспектам (ABSA) отзывов о ноутбуках. Она оценивает пары «кандидат аспекта — предложение» и относит их к классу «аспект» или «не аспект». Модель основана на дообученном энкодере предложений sentence-transformers/all-MiniLM-L6-v2 с классификационной головой LogisticRegression; содержит 25,9 млн параметров и принимает последовательности длиной до 512 токенов по метаданным (в README указан предел 256 токенов).

Модель предназначена для этапа после выделения возможных фрагментов аспектов, например spaCy, и перед классификацией тональности аспектов. README приводит точность 0,824 на указанной метрике и описывает обучение SetFit с контрастивным дообучением и классификатором на малом количестве примеров. Лицензия в предоставленных данных не указана.

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

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

Ограничения

Модель обучена для фильтрации кандидатов аспектов в контексте отзывов о ноутбуках и сама не выполняет полный конвейер ABSA или классификацию тональности. В README указана точность 0,824; предел длины последовательности в README (256 токенов) расходится с метаданными (512 токенов).

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

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

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

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

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

Открыть на Hugging Face

SetFit Aspect Model with sentence-transformers/all-MiniLM-L6-v2

This is a SetFit model that can be used for Aspect Based Sentiment Analysis (ABSA). This SetFit model uses sentence-transformers/all-MiniLM-L6-v2 as the Sentence Transformer embedding model. A LogisticRegression instance is used for classification. In particular, this model is in charge of filtering aspect span candidates.

The model has been trained using an efficient few-shot learning technique that involves:

  1. Fine-tuning a Sentence Transformer with contrastive learning.
  2. Training a classification head with features from the fine-tuned Sentence Transformer.

This model was trained within the context of a larger system for ABSA, which looks like so:

  1. Use a spaCy model to select possible aspect span candidates.
  2. Use this SetFit model to filter these possible aspect span candidates.
  3. Use a SetFit model to classify the filtered aspect span candidates.

Model Details

Model Description

Model Sources

Model Labels

LabelExamples
aspect'cord:I charge it at night and skip taking the cord with me because of the good battery life.''battery life:I charge it at night and skip taking the cord with me because of the good battery life.''service center:The tech guy then said the service center does not do 1-to-1 exchange and I have to direct my concern to the "sales" team, which is the retail shop which I bought my netbook from.'
no aspect'night:I charge it at night and skip taking the cord with me because of the good battery life.''skip:I charge it at night and skip taking the cord with me because of the good battery life.''exchange:The tech guy then said the service center does not do 1-to-1 exchange and I have to direct my concern to the "sales" team, which is the retail shop which I bought my netbook from.'

Evaluation

Metrics

LabelAccuracy
all0.8240

Uses

Direct Use for Inference

First install the SetFit library:

pip install setfit

Then you can load this model and run inference.

from setfit import AbsaModel

# Download from the 🤗 Hub
model = AbsaModel.from_pretrained(
    "joshuasundance/setfit-absa-all-MiniLM-L6-v2-laptops-aspect",
    "joshuasundance/setfit-absa-all-mpnet-base-v2-laptops-polarity",
    spacy_model="en_core_web_sm",
)
# Run inference
preds = model("This laptop meets every expectation and Windows 7 is great!")

Training Details

Training Set Metrics

Training setMinMedianMax
Word count221.151042
LabelTraining Sample Count
no aspect119
aspect126

Training Hyperparameters

  • batch_size: (128, 128)
  • num_epochs: (5, 5)
  • max_steps: -1
  • sampling_strategy: oversampling
  • body_learning_rate: (2e-05, 1e-05)
  • head_learning_rate: 0.01
  • loss: CosineSimilarityLoss
  • distance_metric: cosine_distance
  • margin: 0.25
  • end_to_end: False
  • use_amp: True
  • warmup_proportion: 0.1
  • seed: 42
  • eval_max_steps: -1
  • load_best_model_at_end: True

Training Results

EpochStepTraining LossValidation Loss
0.004210.3776-
0.2110500.26440.2622
0.42191000.22480.2437
0.63291500.00590.2238
0.84392000.00170.2326
1.05492500.00120.2382
1.26583000.00080.2455
1.47683500.00060.2328
1.68784000.00050.243
  • The bold row denotes the saved checkpoint.

Framework Versions

  • Python: 3.11.7
  • SetFit: 1.0.3
  • Sentence Transformers: 2.3.0
  • spaCy: 3.7.2
  • Transformers: 4.37.2
  • PyTorch: 2.1.2+cu118
  • Datasets: 2.16.1
  • Tokenizers: 0.15.1

Citation

BibTeX

@article{https://doi.org/10.48550/arxiv.2209.11055,
    doi = {10.48550/ARXIV.2209.11055},
    url = {https://arxiv.org/abs/2209.11055},
    author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
    keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
    title = {Efficient Few-Shot Learning Without Prompts},
    publisher = {arXiv},
    year = {2022},
    copyright = {Creative Commons Attribution 4.0 International}
}

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

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

GPU в ailist

Универсальный рантайм · setfit

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

Модели SetFit требуют отдельного рантайма.

Класс архитектуры
BertModel
Ревизия весов
61366dd

0 моделей