Views
No views yet
| File | Size | Description |
|---|---|---|
deepmoji_fp32.onnx | 90 MB | fp32, unrolled LSTM — fastest inference |
deepmoji_fp16.onnx | 46 MB | fp16 — ~2× smaller, same predictions |
deepmoji_int8.onnx | 51 MB | int8 dynamic quant, Loop-op LSTM |
vocabulary.json | 1.1 MB | 50 000-token vocabulary |
emoji_codes.json | 1.4 KB | 64 emoji index → char mapping |
pip install deepmoji-onnx1from deepmoji_onnx import DeepMojiONNX
2
3dm = DeepMojiONNX.from_pretrained() # downloads fp32 automatically
4dm = DeepMojiONNX.from_pretrained("fp16")
5dm = DeepMojiONNX.from_pretrained("int8")
6
7dm.top_emojis(["I love this so much!!!"], k=5)
8# [{':hearts:': 0.17, ':blue_heart:': 0.10, ':heart:': 0.08, ...}]
9
10probs = dm.predict(sentences) # (N, 64) softmax
11feats = dm.encode(sentences) # (N, 64) — use feature-mode export for 2304-d| Name | Shape | Dtype | Description |
|---|---|---|---|
| tokens | (B, T) int64 | int64 | Zero-padded token IDs |
| lengths | (B,) int64 | int64 | Actual sequence lengths |
| output | (B, 64) fp32 | float | Emoji softmax probabilities |
convert/ folder for the scripts used to generate these files.1# install export deps
2pip install deepmoji-onnx[export]
3
4# fp32
5python convert/export_fp32.py --weights pytorch_model.bin --vocab vocabulary.json
6
7# fp16
8python convert/export_fp16.py --weights pytorch_model.bin --vocab vocabulary.json
9
10# int8
11python convert/export_int8.py --weights pytorch_model.bin --vocab vocabulary.jsonpytorch_model.bin (~86 MB) can be downloaded from:https://www.dropbox.com/s/q8lax9ary32c7t9/pytorch_model.bin?dl=1tokens (B, T)
└─ Embedding(50000, 256) + tanh
└─ BiLSTM[hard sigmoid](256→1024)
└─ BiLSTM[hard sigmoid](1024→1024)
└─ skip-concat [lstm_1 | lstm_0 | embed] → (B, T, 2304)
└─ Self-attention pool → (B, 2304)
└─ Linear(2304→64) + Softmax → (B, 64)clamp(0.2x + 0.5, 0, 1) — matches original Keras/torchMoji definition.1@inproceedings{felbo2017,
2 title={Using millions of emoji occurrences to learn any-domain representations for detecting sentiment, emotion and sarcasm},
3 author={Felbo, Bjarke and Mislove, Alan and Søgaard, Anders and Bengio, Samy and Lieber, Iyad},
4 booktitle={EMNLP},
5 year={2017}
6}