Commit
Β·
df8dc88
1
Parent(s):
ad00394
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,51 +1,60 @@
|
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
datasets:
|
| 3 |
+
- KomeijiForce/Text2Emoji
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
metrics:
|
| 7 |
+
- bertscore
|
| 8 |
+
pipeline_tag: text2text-generation
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# EmojiLM
|
| 12 |
+
|
| 13 |
+
This is a [BART](https://huggingface.co/facebook/bart-base) model pre-trained on the [Text2Emoji](https://huggingface.co/datasets/KomeijiForce/Text2Emoji) dataset to translate emojis into texts.
|
| 14 |
+
|
| 15 |
+
For instance, "ππ" will be translated into "I love pizza".
|
| 16 |
+
|
| 17 |
+
An example implementation for translation:
|
| 18 |
+
|
| 19 |
+
```python
|
| 20 |
+
from transformers import BartTokenizer, BartForConditionalGeneration
|
| 21 |
+
|
| 22 |
+
def translate(sentence, **argv):
|
| 23 |
+
inputs = tokenizer(sentence, return_tensors="pt")
|
| 24 |
+
generated_ids = generator.generate(inputs["input_ids"], **argv)
|
| 25 |
+
decoded = tokenizer.decode(generated_ids[0], skip_special_tokens=True)
|
| 26 |
+
return decoded
|
| 27 |
+
|
| 28 |
+
path = "KomeijiForce/bart-base-emojilm-e2t"
|
| 29 |
+
tokenizer = BartTokenizer.from_pretrained(path)
|
| 30 |
+
generator = BartForConditionalGeneration.from_pretrained(path)
|
| 31 |
+
|
| 32 |
+
sentence = "π£π±π"
|
| 33 |
+
decoded = translate(sentence, num_beams=4, do_sample=True, max_length=100)
|
| 34 |
+
print(decoded)
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
You will probably get some output like "Sushi is my go-to comfort food."
|
| 38 |
+
|
| 39 |
+
If you find this model & dataset resource useful, please consider cite our paper:
|
| 40 |
+
|
| 41 |
+
```
|
| 42 |
+
@article{DBLP:journals/corr/abs-2311-01751,
|
| 43 |
+
author = {Letian Peng and
|
| 44 |
+
Zilong Wang and
|
| 45 |
+
Hang Liu and
|
| 46 |
+
Zihan Wang and
|
| 47 |
+
Jingbo Shang},
|
| 48 |
+
title = {EmojiLM: Modeling the New Emoji Language},
|
| 49 |
+
journal = {CoRR},
|
| 50 |
+
volume = {abs/2311.01751},
|
| 51 |
+
year = {2023},
|
| 52 |
+
url = {https://doi.org/10.48550/arXiv.2311.01751},
|
| 53 |
+
doi = {10.48550/ARXIV.2311.01751},
|
| 54 |
+
eprinttype = {arXiv},
|
| 55 |
+
eprint = {2311.01751},
|
| 56 |
+
timestamp = {Tue, 07 Nov 2023 18:17:14 +0100},
|
| 57 |
+
biburl = {https://dblp.org/rec/journals/corr/abs-2311-01751.bib},
|
| 58 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
| 59 |
+
}
|
| 60 |
+
```
|