1
- # Zero-shot User Intent Detection via Capsule Neural Networks (PyTorch Implementation)
1
+ # GPU-accelerated PyTorch implementation of Zero-shot User Intent Detection via Capsule Neural Networks
2
2
3
- This repository implements a capsule model named IntentCapsNet-ZSL on the SNIPS-NLU dataset with PyTorch (extension of Tensorflow version)
3
+ This repository implements a capsule model IntentCapsNet-ZSL on the SNIPS-NLU dataset in Python 3
4
+ with PyTorch, first introduced in the paper _ Zero-shot User Intent Detection via Capsule Neural Networks_ .
4
5
5
- The official Tensorflow version is available:
6
- https://github.com/congyingxia/ZeroShotCapsule
6
+ The code aims to follow PyTorch best practices, using ` torch ` instead of ` numpy ` where possible, and using
7
+ ` .cuda() ` for GPU computation. Feel free to contribute via pull requests.
7
8
8
- Please see the following paper for the details:
9
-
10
- Congying Xia* , Chenwei Zhang* , Xiaohui Yan, Yi Chang, Philip S. Yu. Zero-shot User
11
- Intent Detection via Capsule Neural Networks. In Proceedings of the 2018 Conference on
12
- Empirical Methods in Natural Language Processing (EMNLP), 2018. (* equally contributed)
9
+ # Requirements
13
10
14
- https://arxiv.org/abs/1809.00385
11
+ python 3.6+
15
12
13
+ torch 1.0.1
16
14
15
+ numpy
17
16
18
- # Requirements
17
+ gensim
19
18
20
- Python 2.7.12
19
+ scikit-learn
21
20
22
- torch 1.0.1
21
+ # Usage and Modification
23
22
24
- Numpy
23
+ * To run the training-validation loop: ` python run.py ` .
24
+ * The custom ` Dataset ` class is implemented in ` dataset.py ` .
25
25
26
- Gensim
26
+ # Acknowledgements
27
+ * Original repository (TensorFlow, Python 2): https://github.com/congyingxia/ZeroShotCapsule
28
+ * Re-implementation (PyTorch, Python 2): https://github.com/nhhoang96/ZeroShotCapsule-PyTorch-
27
29
28
- Sklearn
30
+ Please see the following paper for the details:
29
31
30
- # Usage
32
+ Congying Xia, Chenwei Zhang, Xiaohui Yan, Yi Chang, Philip S. Yu. Zero-shot User
33
+ Intent Detection via Capsule Neural Networks. In Proceedings of the 2018 Conference on
34
+ Empirical Methods in Natural Language Processing (EMNLP), 2018.
31
35
32
- ```
33
- python main.py
34
- ```
36
+ https://arxiv.org/abs/1809.00385
35
37
36
- If you find the code useful, please cite the paper.
37
38
38
39
```
39
40
@article{xia2018zero,
@@ -43,11 +44,7 @@ If you find the code useful, please cite the paper.
43
44
year={2018}
44
45
}
45
46
```
46
-
47
- # Acknowledgements
48
- https://github.com/congyingxia/ZeroShotCapsule
49
-
50
- https://github.com/soskek/dynamic_routing_between_capsules
51
-
52
- https://github.com/ExplorerFreda/Structured-Self-Attentive-Sentence-Embedding
47
+ # References
48
+ * https://github.com/soskek/dynamic_routing_between_capsules
49
+ * https://github.com/ExplorerFreda/Structured-Self-Attentive-Sentence-Embedding
53
50
0 commit comments