File size: 1,199 Bytes
5e4ba1c
 
7e236b4
 
 
b4748e4
7e236b4
 
 
 
 
5e4ba1c
7e236b4
 
 
a8fabbc
7e236b4
b411d6a
 
a8fabbc
 
 
 
 
b411d6a
 
 
 
 
 
 
 
 
 
 
 
 
6d96181
 
 
 
 
 
 
 
 
 
b411d6a
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
license: mit
language:
- en
pipeline_tag: token-classification
inference: false
tags:
- token-classification
- entity-recognition
- generic
- feature-extraction
---

## Model

The base version of [roberta-base](https://huggingface.co/roberta-base) finetunned on an artificially annotated subset of C4. This model provides domain-independent embedding for Entity Recognition Task.

## Usage

Embeddings can be used out of the box or fine-tuned on specific datasets. 

Get embeddings:


```python
import torch
import transformers


model = transformers.AutoModel.from_pretrained(
    'numind/entity-recognition-general-sota-v1',
    output_hidden_states=True
)
tokenizer = transformers.AutoTokenizer.from_pretrained(
    'numind/entity-recognition-general-sota-v1'
)

text = [
    "NuMind is an AI company based in Paris and USA.",
    "See other models from us on https://huggingface.co/numind"
]
encoded_input = tokenizer(
    text,
    return_tensors='pt',
    padding=True,
    truncation=True
)
output = model(**encoded_input)

# for better quality
emb = torch.cat(
    (output.hidden_states[-1], output.hidden_states[-7]),
    dim=2
)

# for better speed
# emb = output.hidden_states[-1]
```