File size: 1,142 Bytes
3bcb469
 
 
1d3b32b
 
 
cf9899b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f002d94
cf9899b
5db38cd
 
d5e9b4f
3bfd110
d5e9b4f
 
 
cf9899b
f002d94
d5e9b4f
cf9899b
f002d94
cf9899b
f002d94
 
 
 
 
 
 
2a6b6a1
f002d94
 
 
cf9899b
 
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
---
license: apache-2.0
---

Base Model: `google/t5-small`

A seq2seq event triggers and entities tagger trained on the dataset: `ahmeshaf/ecb_plus_ed`

## Usage

Input:
  ```shell
  triggers: I like this model and hate this sentence
  ```

Output:
  ```shell
  like | hate
  ```

- Python
  
### Using .generate()
```python
from transformers import GenerationConfig, T5ForConditionalGeneration, T5Tokenizer

model_name = "ahmeshaf/ecb_tagger_seq2seq"

model = T5ForConditionalGeneration.from_pretrained(model_name)
tokenizer = T5Tokenizer.from_pretrained(model_name)
generation_config = GenerationConfig.from_pretrained(model_name)

tokenized_inputs = tokenizer(["I like this model and hate this sentence ."], return_tensors="pt")
outputs = model.generate(**tokenized_inputs, generation_config=generation_config)

print(tokenizer.batch_decode(outputs, skip_special_tokens=True))

# ['like | hate']
```

### Using pipeline

```python
from transformers import pipeline
srl = pipeline("text2text-generation", "ahmeshaf/ecb_tagger_seq2seq")
print(srl(["I like this model and hate this sentence ."]))

# [{'generated_text': 'like | hate'}]
```