hellonlp commited on
Commit
e72c3d4
1 Parent(s): f03f4ae

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +28 -0
README.md CHANGED
@@ -43,4 +43,32 @@ The evaluation dataset is in Chinese, and we used the same language model **RoBE
43
 
44
 
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
 
43
 
44
 
45
 
46
+ ## Uses
47
+ To use the tool, first install the `promcse` package from [PyPI](https://pypi.org/project/promcse/)
48
+ ```bash
49
+ pip install promcse
50
+ ```
51
+
52
+ After installing the package, you can load our model by two lines of code
53
+ ```python
54
+ from promcse import PromCSE
55
+ model = PromCSE("hellonlp/promcse-bert-base-zh", "cls", 10)
56
+ ```
57
+
58
+ Then you can use our model for encoding sentences into embeddings
59
+ ```python
60
+ embeddings = model.encode("武汉是一个美丽的城市。")
61
+ print(embeddings.shape)
62
+ #torch.Size([1024])
63
+ ```
64
+
65
+ Compute the cosine similarities between two groups of sentences
66
+ ```python
67
+ sentences_a = ['你好吗']
68
+ sentences_b = ['你怎么样','我吃了一个苹果','你过的好吗','你还好吗','你',
69
+ '你好不好','你好不好呢','我不开心','我好开心啊', '你吃饭了吗',
70
+ '你好吗','你现在好吗','你好个鬼']
71
+ similarities = model.similarity(sentences_a, sentences_b)
72
+ print(similarities)
73
+ ```
74