kiddothe2b
commited on
Commit
•
31b062d
1
Parent(s):
95666ab
Update README.md
Browse files
README.md
CHANGED
@@ -6,7 +6,7 @@ datasets:
|
|
6 |
metrics:
|
7 |
- accuracy
|
8 |
model-index:
|
9 |
-
- name: danish-legal-longformer-eurlex
|
10 |
results:
|
11 |
- task:
|
12 |
type: text-classification
|
@@ -29,15 +29,57 @@ model-index:
|
|
29 |
|
30 |
This model is a fine-tuned version of [coastalcph/danish-legal-longformer-base](https://huggingface.co/coastalcph/danish-legal-longformer-base) on the Danish part of [MultiEURLEX](https://huggingface.co/datasets/multi_eurlex) dataset.
|
31 |
|
32 |
-
## Intended uses & limitations
|
33 |
-
|
34 |
-
More information needed
|
35 |
-
|
36 |
## Training and evaluation data
|
37 |
|
38 |
The Danish part of [MultiEURLEX](https://huggingface.co/datasets/multi_eurlex) dataset.
|
39 |
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
- Transformers 4.18.0
|
43 |
- Pytorch 1.12.0+cu113
|
|
|
6 |
metrics:
|
7 |
- accuracy
|
8 |
model-index:
|
9 |
+
- name: coastalcph/danish-legal-longformer-eurlex
|
10 |
results:
|
11 |
- task:
|
12 |
type: text-classification
|
|
|
29 |
|
30 |
This model is a fine-tuned version of [coastalcph/danish-legal-longformer-base](https://huggingface.co/coastalcph/danish-legal-longformer-base) on the Danish part of [MultiEURLEX](https://huggingface.co/datasets/multi_eurlex) dataset.
|
31 |
|
|
|
|
|
|
|
|
|
32 |
## Training and evaluation data
|
33 |
|
34 |
The Danish part of [MultiEURLEX](https://huggingface.co/datasets/multi_eurlex) dataset.
|
35 |
|
36 |
+
## Use of Model
|
37 |
+
|
38 |
+
### As a text classifier:
|
39 |
+
|
40 |
+
```python
|
41 |
+
from transformers import pipeline
|
42 |
+
import numpy as np
|
43 |
+
|
44 |
+
# Init text classification pipeline
|
45 |
+
text_cls_pipe = pipeline(task="text-classification",
|
46 |
+
model="coastalcph/danish-legal-longformer-eurlex",
|
47 |
+
use_auth_token='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')
|
48 |
+
|
49 |
+
# Encode and Classify document
|
50 |
+
predictions = text_cls_pipe("KOMMISSIONENS BESLUTNING\naf 6. marts 2006\nom klassificering af visse byggevarers "
|
51 |
+
"ydeevne med hensyn til reaktion ved brand for så vidt angår trægulve samt vægpaneler "
|
52 |
+
"og vægbeklædning i massivt træ\n(meddelt under nummer K(2006) 655")
|
53 |
+
|
54 |
+
# Print prediction
|
55 |
+
print(predictions)
|
56 |
+
# [{'label': 'building and public works', 'score': 0.9626012444496155}]
|
57 |
+
```
|
58 |
+
|
59 |
+
### As a feature extractor (document embedder):
|
60 |
+
|
61 |
+
```python
|
62 |
+
from transformers import pipeline
|
63 |
+
import numpy as np
|
64 |
+
|
65 |
+
# Init feature extraction pipeline
|
66 |
+
feature_extraction_pipe = pipeline(task="feature-extraction",
|
67 |
+
model="coastalcph/danish-legal-longformer-eurlex",
|
68 |
+
use_auth_token='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')
|
69 |
+
|
70 |
+
# Encode document
|
71 |
+
predictions = feature_extraction_pipe("KOMMISSIONENS BESLUTNING\naf 6. marts 2006\nom klassificering af visse byggevarers "
|
72 |
+
"ydeevne med hensyn til reaktion ved brand for så vidt angår trægulve samt vægpaneler "
|
73 |
+
"og vægbeklædning i massivt træ\n(meddelt under nummer K(2006) 655")
|
74 |
+
|
75 |
+
# Use CLS token representation as document embedding
|
76 |
+
document_features = token_wise_features[0][0]
|
77 |
+
|
78 |
+
print(document_features.shape)
|
79 |
+
# (768,)
|
80 |
+
```
|
81 |
+
|
82 |
+
## Framework versions
|
83 |
|
84 |
- Transformers 4.18.0
|
85 |
- Pytorch 1.12.0+cu113
|