Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New classification models #1657

Open
wants to merge 39 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
292edf4
Added new classification models
Kolpnick Jul 27, 2023
eff06dc
Added new NER model
Kolpnick Jul 27, 2023
d2d3ef7
Added new models to tests
Kolpnick Jul 27, 2023
46ca69c
Fixed NER bug with multiple GPUs
Kolpnick Jul 27, 2023
a30ee37
Added NER input clipping
Kolpnick Jul 27, 2023
09fafcb
Add delimiter component
vaskonov Jul 27, 2023
8fd57ea
Add delimiter requirement
vaskonov Jul 27, 2023
e93073b
Add support long sequences
vaskonov Jul 27, 2023
2ef420f
Add delimiter
vaskonov Jul 27, 2023
658a85f
Skip empty sequences
vaskonov Jul 27, 2023
df3aee0
Restore the short variant
vaskonov Jul 27, 2023
ac1511e
Create long demo config
vaskonov Jul 27, 2023
ed4270f
Updated ner config
Kolpnick Jul 31, 2023
f19103e
Update DEMO NER
vaskonov Jul 31, 2023
1926219
Fix
vaskonov Jul 31, 2023
3431e3a
Add sentence_concatenator
vaskonov Aug 1, 2023
e371cac
Add sentence_concatenator
vaskonov Aug 1, 2023
35dea2e
Add sentence_concatenator
vaskonov Aug 1, 2023
528cc4d
Fix delimiter
vaskonov Aug 1, 2023
d359673
Updated NER configs
Kolpnick Aug 1, 2023
3b7680c
Fixed NER bug with interpunction
Kolpnick Aug 2, 2023
998894b
Updated model download url
Kolpnick Aug 2, 2023
108d96e
Updated model download url
Kolpnick Aug 2, 2023
1dbed3c
Updated NER model download url
Kolpnick Aug 10, 2023
e12a869
Updated NER config
Kolpnick Aug 10, 2023
60c8060
Added new intents classification config
Kolpnick Sep 5, 2023
64081e1
Moved bug fixes to new PR
Kolpnick Sep 18, 2023
8e9a4f4
feat: config for address model
annakorz May 14, 2024
ff1c10b
fix: address model conifg updated
annakorz May 14, 2024
44debd2
fix: update address model config download link
annakorz May 14, 2024
851e10a
update: config for address model
annakorz May 17, 2024
87a78cf
fix: address config
annakorz May 21, 2024
f4ac5f1
upd demo weights path
LogicZMaksimka May 30, 2024
0b5eb17
upd demo output format
LogicZMaksimka May 31, 2024
6f2cd01
changed sentence delimeter output format
LogicZMaksimka May 31, 2024
339132e
revert sentence delimeter output format
LogicZMaksimka May 31, 2024
a4ce357
upd demo model weights
LogicZMaksimka Jul 9, 2024
f32ef88
upd demo ner model
LogicZMaksimka Oct 25, 2024
bf83193
add download
LogicZMaksimka Oct 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions deeppavlov/configs/classifiers/emotions_xlm_roberta_base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"dataset_reader": {
"class_name": "huggingface_dataset_reader",
"path": "cedr",
"name": "main",
"train": "train",
"test": "test"
},
"dataset_iterator": {
"class_name": "huggingface_dataset_iterator",
"features": "text",
"label": "labels",
"seed": 42
},
"chainer": {
"in": ["x"],
"in_y": ["y"],
"pipe": [
{
"class_name": "torch_transformers_preprocessor",
"vocab_file": "{BASE_MODEL}",
"do_lower_case": false,
"max_seq_length": 128,
"in": ["x"],
"out": ["bert_features"]
},
{
"id": "classes_vocab",
"class_name": "simple_vocab",
"fit_on": ["y"],
"save_path": "{MODEL_PATH}/classes.dict",
"load_path": "{MODEL_PATH}/classes.dict",
"in": ["y"],
"out": ["y_ids"]
},
{
"in": ["y_ids"],
"out": ["y_onehot"],
"class_name": "one_hotter",
"depth": "#classes_vocab.len",
"single_vector": true
},
{
"class_name": "torch_transformers_classifier",
"n_classes": "#classes_vocab.len",
"return_probas": true,
"pretrained_bert": "{BASE_MODEL}",
"save_path": "{MODEL_PATH}/model",
"load_path": "{MODEL_PATH}/model",
"optimizer": "AdamW",
"optimizer_parameters": {
"lr": 1e-05
},
"learning_rate_drop_patience": 3,
"learning_rate_drop_div": 2.0,
"in": ["bert_features"],
"in_y": ["y_ids"],
"out": ["y_pred_probas"]
},
{
"in": ["y_pred_probas"],
"out": ["y_pred_ids"],
"class_name": "proba2labels",
"max_proba": true
},
{
"in": ["y_pred_ids"],
"out": ["y_pred_labels"],
"ref": "classes_vocab"
}
],
"out": ["y_pred_labels"]
},
"train": {
"batch_size": 64,
"metrics": [
"accuracy",
"f1_weighted",
"f1_macro"
],
"validation_patience": 10,
"val_every_n_epochs": 1,
"log_every_n_epochs": 1,
"show_examples": false,
"evaluation_targets": ["train", "test"],
"class_name": "torch_trainer",
"tensorboard_log_dir": "{MODEL_PATH}/",
"pytest_max_batches": 2
},
"metadata": {
"variables": {
"BASE_MODEL": "xlm-roberta-base",
"ROOT_PATH": "~/.deeppavlov",
"DOWNLOADS_PATH": "{ROOT_PATH}/downloads",
"MODELS_PATH": "{ROOT_PATH}/models",
"MODEL_PATH": "{MODELS_PATH}/emotions_classifier/{BASE_MODEL}"
},
"download": [
{
"url": "http://files.deeppavlov.ai/v1/classifiers/emotions/emotions_xlm_roberta_base.tar.gz",
"subdir": "{MODEL_PATH}"
}
]
}
}
106 changes: 106 additions & 0 deletions deeppavlov/configs/classifiers/insults_xlm_roberta_base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"dataset_reader": {
"class_name": "basic_classification_reader",
"x": "Comment",
"y": "Class",
"data_path": "{DOWNLOADS_PATH}/insults_data"
},
"dataset_iterator": {
"class_name": "basic_classification_iterator",
"seed": 42
},
"chainer": {
"in": ["x"],
"in_y": ["y"],
"pipe": [
{
"class_name": "torch_transformers_preprocessor",
"vocab_file": "{BASE_MODEL}",
"do_lower_case": false,
"max_seq_length": 128,
"in": ["x"],
"out": ["bert_features"]
},
{
"id": "classes_vocab",
"class_name": "simple_vocab",
"fit_on": ["y"],
"save_path": "{MODEL_PATH}/classes.dict",
"load_path": "{MODEL_PATH}/classes.dict",
"in": ["y"],
"out": ["y_ids"]
},
{
"in": ["y_ids"],
"out": ["y_onehot"],
"class_name": "one_hotter",
"depth": "#classes_vocab.len",
"single_vector": true
},
{
"class_name": "torch_transformers_classifier",
"n_classes": "#classes_vocab.len",
"return_probas": true,
"pretrained_bert": "{BASE_MODEL}",
"save_path": "{MODEL_PATH}/model",
"load_path": "{MODEL_PATH}/model",
"optimizer": "AdamW",
"optimizer_parameters": {
"lr": 1e-05
},
"learning_rate_drop_patience": 3,
"learning_rate_drop_div": 2.0,
"in": ["bert_features"],
"in_y": ["y_ids"],
"out": ["y_pred_probas"]
},
{
"in": ["y_pred_probas"],
"out": ["y_pred_ids"],
"class_name": "proba2labels",
"max_proba": true
},
{
"in": ["y_pred_ids"],
"out": ["y_pred_labels"],
"ref": "classes_vocab"
}
],
"out": ["y_pred_labels"]
},
"train": {
"batch_size": 256,
"metrics": [
"accuracy",
"f1_weighted",
"f1_macro"
],
"validation_patience": 10,
"val_every_n_epochs": 1,
"log_every_n_epochs": 1,
"show_examples": false,
"evaluation_targets": ["train", "valid"],
"class_name": "torch_trainer",
"tensorboard_log_dir": "{MODEL_PATH}/",
"pytest_max_batches": 2
},
"metadata": {
"variables": {
"BASE_MODEL": "xlm-roberta-base",
"ROOT_PATH": "~/.deeppavlov",
"DOWNLOADS_PATH": "{ROOT_PATH}/downloads",
"MODELS_PATH": "{ROOT_PATH}/models",
"MODEL_PATH": "{MODELS_PATH}/insults_classifier/{BASE_MODEL}"
},
"download": [
{
"url": "http://files.deeppavlov.ai/datasets/insults_data.tar.gz",
"subdir": "{DOWNLOADS_PATH}"
},
{
"url": "http://files.deeppavlov.ai/v1/classifiers/insults/insults_xlm_roberta_base.tar.gz",
"subdir": "{MODEL_PATH}"
}
]
}
}
105 changes: 105 additions & 0 deletions deeppavlov/configs/classifiers/intents_distilbert_base_multi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"dataset_reader": {
"class_name": "huggingface_dataset_reader",
"path": "AmazonScience/massive",
"name": "all",
"train": "train",
"valid": "validation",
"test": "test"
},
"dataset_iterator": {
"class_name": "huggingface_dataset_iterator",
"features": "utt",
"label": "intent",
"seed": 42
},
"chainer": {
"in": ["x"],
"in_y": ["y"],
"pipe": [
{
"class_name": "torch_transformers_preprocessor",
"vocab_file": "{BASE_MODEL}",
"do_lower_case": false,
"max_seq_length": 128,
"in": ["x"],
"out": ["bert_features"]
},
{
"id": "classes_vocab",
"class_name": "simple_vocab",
"fit_on": ["y"],
"save_path": "{MODEL_PATH}/classes.dict",
"load_path": "{MODEL_PATH}/classes.dict",
"in": ["y"],
"out": ["y_ids"]
},
{
"in": ["y_ids"],
"out": ["y_onehot"],
"class_name": "one_hotter",
"depth": "#classes_vocab.len",
"single_vector": true
},
{
"class_name": "torch_transformers_classifier",
"n_classes": "#classes_vocab.len",
"return_probas": true,
"pretrained_bert": "{BASE_MODEL}",
"save_path": "{MODEL_PATH}/model",
"load_path": "{MODEL_PATH}/model",
"optimizer": "AdamW",
"optimizer_parameters": {
"lr": 2e-05
},
"learning_rate_drop_patience": 3,
"learning_rate_drop_div": 2.0,
"in": ["bert_features"],
"in_y": ["y_ids"],
"out": ["y_pred_probas"]
},
{
"in": ["y_pred_probas"],
"out": ["y_pred_ids"],
"class_name": "proba2labels",
"max_proba": true
},
{
"in": ["y_pred_ids"],
"out": ["y_pred_labels"],
"ref": "classes_vocab"
}
],
"out": ["y_pred_labels"]
},
"train": {
"batch_size": 128,
"metrics": [
"accuracy",
"f1_weighted"
],
"validation_patience": 10,
"val_every_n_epochs": 1,
"log_every_n_epochs": 1,
"show_examples": false,
"evaluation_targets": ["train", "valid"],
"class_name": "torch_trainer",
"tensorboard_log_dir": "{MODEL_PATH}/",
"pytest_max_batches": 2
},
"metadata": {
"variables": {
"BASE_MODEL": "distilbert-base-multilingual-cased",
"ROOT_PATH": "~/.deeppavlov",
"DOWNLOADS_PATH": "{ROOT_PATH}/downloads",
"MODELS_PATH": "{ROOT_PATH}/models",
"MODEL_PATH": "{MODELS_PATH}/intents_classification/{BASE_MODEL}"
},
"download": [
{
"url": "http://files.deeppavlov.ai/v1/classifiers/intents/intents_classification_distilbert_multi.tar.gz",
"subdir": "{MODEL_PATH}"
}
]
}
}
Loading