Futyn-Maker commited on
Commit
bfd2961
·
verified ·
1 Parent(s): eb00b8f

Upload Russian Constructicon span predictor model

Browse files
config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "XLMRobertaForQuestionAnswering"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": 0,
7
+ "classifier_dropout": null,
8
+ "eos_token_id": 2,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 1024,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 4096,
14
+ "layer_norm_eps": 1e-05,
15
+ "max_position_embeddings": 514,
16
+ "model_type": "xlm-roberta",
17
+ "num_attention_heads": 16,
18
+ "num_hidden_layers": 24,
19
+ "output_past": true,
20
+ "pad_token_id": 1,
21
+ "position_embedding_type": "absolute",
22
+ "torch_dtype": "float32",
23
+ "transformers_version": "4.51.3",
24
+ "type_vocab_size": 1,
25
+ "use_cache": true,
26
+ "vocab_size": 35054
27
+ }
eval_results.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ correct = 373
2
+ eval_loss = -9.542310393258427
3
+ incorrect = 198
4
+ similar = 2271
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:302af33edd02ce86c66a29bacbd0e40c36f1b5f4905493ad6ae282fddf2d82ce
3
+ size 1354992496
model_args.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"adafactor_beta1": null, "adafactor_clip_threshold": 1.0, "adafactor_decay_rate": -0.8, "adafactor_eps": [1e-30, 0.001], "adafactor_relative_step": true, "adafactor_scale_parameter": true, "adafactor_warmup_init": true, "adam_betas": [0.9, 0.999], "adam_epsilon": 1e-08, "best_model_dir": "outputs/best_model", "cache_dir": "cache_dir/", "config": {}, "cosine_schedule_num_cycles": 0.5, "custom_layer_parameters": [], "custom_parameter_groups": [], "dataloader_num_workers": 0, "do_lower_case": false, "dynamic_quantize": false, "early_stopping_consider_epochs": false, "early_stopping_delta": 0, "early_stopping_metric": "correct", "early_stopping_metric_minimize": false, "early_stopping_patience": 3, "encoding": null, "eval_batch_size": 32, "evaluate_during_training": true, "evaluate_during_training_silent": true, "evaluate_during_training_steps": 2000, "evaluate_during_training_verbose": true, "evaluate_each_epoch": true, "fp16": true, "gradient_accumulation_steps": 1, "learning_rate": 3e-05, "local_rank": -1, "logging_steps": 50, "loss_type": null, "loss_args": {}, "manual_seed": 42, "max_grad_norm": 1.0, "max_seq_length": 384, "model_name": "DeepPavlov/xlm-roberta-large-en-ru", "model_type": "xlmroberta", "multiprocessing_chunksize": -1, "n_gpu": 1, "no_cache": false, "no_save": false, "not_saved_args": [], "num_train_epochs": 10, "optimizer": "AdamW", "output_dir": "qa_model", "overwrite_output_dir": true, "polynomial_decay_schedule_lr_end": 1e-07, "polynomial_decay_schedule_power": 1.0, "process_count": 94, "quantized_model": false, "reprocess_input_data": true, "save_best_model": true, "save_eval_checkpoints": true, "save_model_every_epoch": false, "save_optimizer_and_scheduler": true, "save_steps": -1, "scheduler": "linear_schedule_with_warmup", "silent": false, "skip_special_tokens": true, "tensorboard_dir": null, "thread_count": null, "tokenizer_name": null, "tokenizer_type": null, "train_batch_size": 32, "train_custom_parameters_only": false, "trust_remote_code": false, "use_cached_eval_features": false, "use_early_stopping": false, "use_hf_datasets": false, "use_multiprocessing": true, "use_multiprocessing_for_evaluation": true, "wandb_kwargs": {}, "wandb_project": null, "warmup_ratio": 0.06, "warmup_steps": 288, "weight_decay": 0.0, "model_class": "QuestionAnsweringModel", "doc_stride": 128, "lazy_loading": false, "max_answer_length": 100, "max_query_length": 64, "n_best_size": 5, "null_score_diff_threshold": 0.0, "special_tokens_list": []}
optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73badd66c0986425dca529605e2b9581f7c9b642dd011dde058e772830199f71
3
+ size 2710216696
readme.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - transformers
4
+ - question-answering
5
+ - russian
6
+ - constructicon
7
+ - nlp
8
+ - linguistics
9
+ base_model: DeepPavlov/xlm-roberta-large-en-ru
10
+ language:
11
+ - ru
12
+ pipeline_tag: question-answering
13
+ widget:
14
+ - text: "Что вам здесь нужно?"
15
+ context: "Что вам здесь нужно?"
16
+ example_title: "Question construction span"
17
+ - text: "Петр так и замер на месте."
18
+ context: "Петр так и замер на месте."
19
+ example_title: "Adverbial construction span"
20
+ ---
21
+
22
+ # Russian Constructicon Span Predictor
23
+
24
+ A question-answering model for identifying construction spans in Russian text. Fine-tuned to locate specific Constructicon pattern implementations within text examples.
25
+
26
+ ## Model Details
27
+
28
+ - **Base model:** [DeepPavlov/xlm-roberta-large-en-ru](https://huggingface.co/DeepPavlov/xlm-roberta-large-en-ru)
29
+ - **Task:** Question Answering / Span Prediction
30
+ - **Language:** Russian
31
+ - **Training:** QA task where context=example, question=construction pattern, answer=construction span
32
+
33
+ ## Usage
34
+
35
+ ### Primary Usage (RusCxnPipe Library)
36
+
37
+ This model is designed for use with the [RusCxnPipe](https://github.com/your-username/ruscxnpipe) library:
38
+
39
+ ```python
40
+ from ruscxnpipe import SpanPredictor
41
+
42
+ predictor = SpanPredictor(model_name="Futyn-Maker/ruscxn-span-predictor")
43
+
44
+ examples_with_patterns = [
45
+ {
46
+ "example": "Что вам здесь нужно?",
47
+ "patterns": [{"id": "pattern1", "pattern": "что NP-Dat Cop нужно?"}]
48
+ }
49
+ ]
50
+
51
+ results = predictor.predict_spans(examples_with_patterns)
52
+ span_info = results[0]['patterns'][0]['span']
53
+ print(f"Span: '{span_info['span_string']}' at {span_info['span_start']}-{span_info['span_end']}")
54
+ ```
55
+
56
+ ### Direct Usage (SimpleTransformers)
57
+
58
+ ```python
59
+ from simpletransformers.question_answering import QuestionAnsweringModel
60
+
61
+ model = QuestionAnsweringModel('xlmroberta', 'Futyn-Maker/ruscxn-span-predictor')
62
+
63
+ # Format: context = Russian text, question = construction pattern
64
+ to_predict = [
65
+ {
66
+ "context": "Что вам здесь нужно?",
67
+ "qas": [
68
+ {
69
+ "question": "что NP-Dat Cop нужно?",
70
+ "id": "0"
71
+ }
72
+ ]
73
+ }
74
+ ]
75
+
76
+ predictions, _ = model.predict(to_predict)
77
+ print(f"Predicted span: {predictions[0]['answer'][0]}")
78
+ ```
79
+
80
+ ## Training Data
81
+
82
+ The model was trained on a question-answering dataset where:
83
+ - **Context:** Russian text examples containing constructions
84
+ - **Question:** Constructicon patterns
85
+ - **Answer:** Text spans implementing the construction in the example
86
+
87
+ ## Output
88
+
89
+ Returns the exact text span where a construction pattern is realized in the input text, including start and end character positions.
90
+
91
+ ## Framework Versions
92
+
93
+ - SimpleTransformers: 0.70.1
94
+ - Transformers: 4.51.3
95
+ - PyTorch: 2.7.0+cu126
scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:555f23472de79eccb61a781dfac070d8fcc3dabdd69ce2af1493c2b812be519e
3
+ size 1465
sentencepiece.bpe.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef009ae2ede7beded780cfa82e11d2d977473cb6ddf9c3b5bdce3c367497fc01
3
+ size 943862
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": true,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "35053": {
36
+ "content": "<mask>",
37
+ "lstrip": true,
38
+ "normalized": true,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "<s>",
45
+ "clean_up_tokenization_spaces": false,
46
+ "cls_token": "<s>",
47
+ "do_lower_case": false,
48
+ "eos_token": "</s>",
49
+ "extra_special_tokens": {},
50
+ "mask_token": "<mask>",
51
+ "model_max_length": 1000000000000000019884624838656,
52
+ "pad_token": "<pad>",
53
+ "sep_token": "</s>",
54
+ "sp_model_kwargs": {},
55
+ "tokenizer_class": "XLMRobertaTokenizer",
56
+ "unk_token": "<unk>"
57
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f18b2f6f84f8705e92cda7c3c2f490e0a1e1443480f8fd56255bf62c267bdb7
3
+ size 3921