Spaces:
Running
Running
bert-crf
Browse files
app.py
CHANGED
@@ -9,9 +9,9 @@ import json
|
|
9 |
|
10 |
st.set_page_config(layout="wide")
|
11 |
|
12 |
-
model = AutoModelForTokenClassification.from_pretrained("models/
|
13 |
|
14 |
-
tokenizer = AutoTokenizer.from_pretrained("models/
|
15 |
tagger = pipeline("ner", model=model, tokenizer=tokenizer, aggregation_strategy='first') #aggregation_strategy='max'
|
16 |
|
17 |
|
|
|
9 |
|
10 |
st.set_page_config(layout="wide")
|
11 |
|
12 |
+
model = AutoModelForTokenClassification.from_pretrained("./models/bert_crf", use_safetensors=True)
|
13 |
|
14 |
+
tokenizer = AutoTokenizer.from_pretrained("./models/bert_crf", model_max_length=512)
|
15 |
tagger = pipeline("ner", model=model, tokenizer=tokenizer, aggregation_strategy='first') #aggregation_strategy='max'
|
16 |
|
17 |
|
models/bert_crf/config.json
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "neuralmind/bert-base-portuguese-cased",
|
3 |
+
"architectures": [
|
4 |
+
"BertCRF"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"classifier_dropout": null,
|
8 |
+
"directionality": "bidi",
|
9 |
+
"hidden_act": "gelu",
|
10 |
+
"hidden_dropout_prob": 0.1,
|
11 |
+
"hidden_size": 768,
|
12 |
+
"id2label": {
|
13 |
+
"0": "I-Time",
|
14 |
+
"1": "B-Time",
|
15 |
+
"2": "I-Event",
|
16 |
+
"3": "B-Spatial_Relation",
|
17 |
+
"4": "B-Participant",
|
18 |
+
"5": "O",
|
19 |
+
"6": "B-Event",
|
20 |
+
"7": "I-Spatial_Relation",
|
21 |
+
"8": "I-Participant"
|
22 |
+
},
|
23 |
+
"initializer_range": 0.02,
|
24 |
+
"intermediate_size": 3072,
|
25 |
+
"label2id": {
|
26 |
+
"B-Event": 6,
|
27 |
+
"B-Participant": 4,
|
28 |
+
"B-Spatial_Relation": 3,
|
29 |
+
"B-Time": 1,
|
30 |
+
"I-Event": 2,
|
31 |
+
"I-Participant": 8,
|
32 |
+
"I-Spatial_Relation": 7,
|
33 |
+
"I-Time": 0,
|
34 |
+
"O": 5
|
35 |
+
},
|
36 |
+
"layer_norm_eps": 1e-12,
|
37 |
+
"max_position_embeddings": 512,
|
38 |
+
"model_type": "bert",
|
39 |
+
"num_attention_heads": 12,
|
40 |
+
"num_hidden_layers": 12,
|
41 |
+
"output_past": true,
|
42 |
+
"pad_token_id": 0,
|
43 |
+
"pooler_fc_size": 768,
|
44 |
+
"pooler_num_attention_heads": 12,
|
45 |
+
"pooler_num_fc_layers": 3,
|
46 |
+
"pooler_size_per_head": 128,
|
47 |
+
"pooler_type": "first_token_transform",
|
48 |
+
"position_embedding_type": "absolute",
|
49 |
+
"torch_dtype": "float32",
|
50 |
+
"transformers_version": "4.41.0",
|
51 |
+
"type_vocab_size": 2,
|
52 |
+
"use_cache": true,
|
53 |
+
"vocab_size": 29794
|
54 |
+
}
|
models/bert_crf/model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5d13498d68c4c240054dbcfa9755a89c5887a0e7cc623eaaec7bd33c6a6d6101
|
3 |
+
size 433381856
|
models/bert_crf/special_tokens_map.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cls_token": "[CLS]",
|
3 |
+
"mask_token": "[MASK]",
|
4 |
+
"pad_token": "[PAD]",
|
5 |
+
"sep_token": "[SEP]",
|
6 |
+
"unk_token": "[UNK]"
|
7 |
+
}
|
models/bert_crf/tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
models/bert_crf/tokenizer_config.json
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"added_tokens_decoder": {
|
3 |
+
"0": {
|
4 |
+
"content": "[PAD]",
|
5 |
+
"lstrip": false,
|
6 |
+
"normalized": false,
|
7 |
+
"rstrip": false,
|
8 |
+
"single_word": false,
|
9 |
+
"special": true
|
10 |
+
},
|
11 |
+
"100": {
|
12 |
+
"content": "[UNK]",
|
13 |
+
"lstrip": false,
|
14 |
+
"normalized": false,
|
15 |
+
"rstrip": false,
|
16 |
+
"single_word": false,
|
17 |
+
"special": true
|
18 |
+
},
|
19 |
+
"101": {
|
20 |
+
"content": "[CLS]",
|
21 |
+
"lstrip": false,
|
22 |
+
"normalized": false,
|
23 |
+
"rstrip": false,
|
24 |
+
"single_word": false,
|
25 |
+
"special": true
|
26 |
+
},
|
27 |
+
"102": {
|
28 |
+
"content": "[SEP]",
|
29 |
+
"lstrip": false,
|
30 |
+
"normalized": false,
|
31 |
+
"rstrip": false,
|
32 |
+
"single_word": false,
|
33 |
+
"special": true
|
34 |
+
},
|
35 |
+
"103": {
|
36 |
+
"content": "[MASK]",
|
37 |
+
"lstrip": false,
|
38 |
+
"normalized": false,
|
39 |
+
"rstrip": false,
|
40 |
+
"single_word": false,
|
41 |
+
"special": true
|
42 |
+
}
|
43 |
+
},
|
44 |
+
"clean_up_tokenization_spaces": true,
|
45 |
+
"cls_token": "[CLS]",
|
46 |
+
"do_basic_tokenize": true,
|
47 |
+
"do_lower_case": false,
|
48 |
+
"mask_token": "[MASK]",
|
49 |
+
"model_max_length": 1000000000000000019884624838656,
|
50 |
+
"never_split": null,
|
51 |
+
"pad_token": "[PAD]",
|
52 |
+
"sep_token": "[SEP]",
|
53 |
+
"strip_accents": null,
|
54 |
+
"tokenize_chinese_chars": true,
|
55 |
+
"tokenizer_class": "BertTokenizer",
|
56 |
+
"unk_token": "[UNK]"
|
57 |
+
}
|
models/bert_crf/training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4d9387a08c40ab2221a567520f6f2ab33976a32ed8307ecfa0f1aa4a5df67200
|
3 |
+
size 5112
|
models/bert_crf/vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|