pe65374 commited on
Commit
a14d899
·
1 Parent(s): 57901e5

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +65 -0
README.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: zh
3
+ pipeline_tag: sentence-similarity
4
+ tags:
5
+ - sentence-transformers
6
+ - feature-extraction
7
+ - sentence-similarity
8
+ - transformers
9
+ license: apache-2.0
10
+ widget:
11
+ source_sentence: "那个人很开心"
12
+ sentences:
13
+ - 那个人非常开心
14
+ - 那只猫很开心
15
+ - 那个人在吃东西
16
+ ---
17
+
18
+ # Chinese Sentence BERT
19
+
20
+ ## Model description
21
+
22
+ This is the sentence embedding model pre-trained by [UER-py](https://github.com/dbiir/UER-py/), which is introduced in [this paper](https://arxiv.org/abs/1909.05658).
23
+
24
+ ## Training data
25
+
26
+ [ChineseTextualInference](https://github.com/liuhuanyong/ChineseTextualInference/) is used as training data.
27
+
28
+ ## Training procedure
29
+
30
+ The model is fine-tuned by [UER-py](https://github.com/dbiir/UER-py/) on [Tencent Cloud](https://cloud.tencent.com/). We fine-tune five epochs with a sequence length of 128 on the basis of the pre-trained model [chinese_roberta_L-12_H-768](https://huggingface.co/uer/chinese_roberta_L-12_H-768). At the end of each epoch, the model is saved when the best performance on development set is achieved.
31
+
32
+ ```
33
+ python3 finetune/run_classifier_siamese.py --pretrained_model_path models/cluecorpussmall_roberta_base_seq512_model.bin-250000 \
34
+ --vocab_path models/google_zh_vocab.txt \
35
+ --config_path models/sbert/base_config.json \
36
+ --train_path datasets/ChineseTextualInference/train.tsv \
37
+ --dev_path datasets/ChineseTextualInference/dev.tsv \
38
+ --learning_rate 5e-5 --epochs_num 5 --batch_size 64
39
+ ```
40
+
41
+ Finally, we convert the pre-trained model into Huggingface's format:
42
+
43
+ ```
44
+ python3 scripts/convert_sbert_from_uer_to_huggingface.py --input_model_path models/finetuned_model.bin \
45
+ --output_model_path pytorch_model.bin \
46
+ --layers_num 12
47
+ ```
48
+
49
+ ### BibTeX entry and citation info
50
+
51
+ ```
52
+ @article{reimers2019sentence,
53
+ title={Sentence-bert: Sentence embeddings using siamese bert-networks},
54
+ author={Reimers, Nils and Gurevych, Iryna},
55
+ journal={arXiv preprint arXiv:1908.10084},
56
+ year={2019}
57
+ }
58
+ @article{zhao2019uer,
59
+ title={UER: An Open-Source Toolkit for Pre-training Models},
60
+ author={Zhao, Zhe and Chen, Hui and Zhang, Jinbin and Zhao, Xin and Liu, Tao and Lu, Wei and Chen, Xi and Deng, Haotang and Ju, Qi and Du, Xiaoyong},
61
+ journal={EMNLP-IJCNLP 2019},
62
+ pages={241},
63
+ year={2019}
64
+ }
65
+ ```