bastitx commited on
Commit
62d4e27
·
1 Parent(s): 7d77a01

add Aleph-Alpha-GermanWeb-Quality-Classifier-BERT model config

Browse files
Files changed (3) hide show
  1. README.md +32 -0
  2. config.json +40 -0
  3. model.safetensors +3 -0
README.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - de
4
+ base_model:
5
+ - google-bert/bert-base-uncased
6
+ ---
7
+ # Aleph-Alpha-GermanWeb-Quality-Classifier-BERT
8
+
9
+ ## Example Snippet
10
+
11
+ ```python
12
+ import torch
13
+ from transformers import BertTokenizer, BertForSequenceClassification
14
+
15
+ device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
16
+
17
+ model = BertForSequenceClassification.from_pretrained("Aleph-Alpha/Aleph-Alpha-GermanWeb-Quality-Classifier-BERT", num_labels=5).to(device)
18
+ model.eval()
19
+
20
+ tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
21
+
22
+ # disclaimer: short text is not in the model distribution
23
+ text = 'Das ist ein Beispieltext, um die Qualität zu überprüfen.'
24
+
25
+ target_names = ['Quality Score 1', 'Quality Score 2', 'Quality Score 3', 'Quality Score 4', 'Quality Score 5']
26
+
27
+ with torch.no_grad():
28
+ prediction = torch.argmax(
29
+ model(**tokenizer(text, return_tensors='pt', truncation=True, padding=True).to(device)).logits
30
+ ).item()
31
+ print(target_names[prediction])
32
+ ```
config.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "bert-base-uncased",
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
8
+ "gradient_checkpointing": false,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 768,
12
+ "id2label": {
13
+ "0": "LABEL_0",
14
+ "1": "LABEL_1",
15
+ "2": "LABEL_2",
16
+ "3": "LABEL_3",
17
+ "4": "LABEL_4"
18
+ },
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 3072,
21
+ "label2id": {
22
+ "LABEL_0": 0,
23
+ "LABEL_1": 1,
24
+ "LABEL_2": 2,
25
+ "LABEL_3": 3,
26
+ "LABEL_4": 4
27
+ },
28
+ "layer_norm_eps": 1e-12,
29
+ "max_position_embeddings": 512,
30
+ "model_type": "bert",
31
+ "num_attention_heads": 12,
32
+ "num_hidden_layers": 12,
33
+ "pad_token_id": 0,
34
+ "position_embedding_type": "absolute",
35
+ "torch_dtype": "float32",
36
+ "transformers_version": "4.48.3",
37
+ "type_vocab_size": 2,
38
+ "use_cache": true,
39
+ "vocab_size": 30522
40
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22a01ce11cc3ac127d758b2a997be73506a902ce2f153c7682097a6178f50085
3
+ size 437967876