chestnutlzj
commited on
Commit
•
da7df2c
1
Parent(s):
afbeed8
initial commit
Browse files- 1_Pooling/config.json +7 -0
- README.md +42 -1
- config.json +34 -0
- config_sentence_transformers.json +7 -0
- modules.json +14 -0
- pytorch_model.bin +3 -0
- sentence_bert_config.json +4 -0
- special_tokens_map.json +7 -0
- tokenizer.json +0 -0
- tokenizer_config.json +13 -0
- vocab.txt +0 -0
1_Pooling/config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"word_embedding_dimension": 768,
|
3 |
+
"pooling_mode_cls_token": false,
|
4 |
+
"pooling_mode_mean_tokens": true,
|
5 |
+
"pooling_mode_max_tokens": false,
|
6 |
+
"pooling_mode_mean_sqrt_len_tokens": false
|
7 |
+
}
|
README.md
CHANGED
@@ -3,4 +3,45 @@ license: apache-2.0
|
|
3 |
language:
|
4 |
- zh
|
5 |
pipeline_tag: sentence-similarity
|
6 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
language:
|
4 |
- zh
|
5 |
pipeline_tag: sentence-similarity
|
6 |
+
---
|
7 |
+
|
8 |
+
# {MODEL_NAME}
|
9 |
+
|
10 |
+
本模型用于法律相关文本的相似度计算。可用于制作向量数据库等。
|
11 |
+
|
12 |
+
# Examples
|
13 |
+
|
14 |
+
> 请问夫妻之间共同财产如何定义?
|
15 |
+
|
16 |
+
1. 最高人民法院关于适用《婚姻法》若干问题的解释(三)(2011-08-09): 第五条 夫妻一方个人财产在婚后产生的收益,除孳息和自然增值外,应认定为夫妻共同财产。
|
17 |
+
2. 最高人民法院关于适用《婚姻法》若干问题的解释(二)的补充规定(2017-02-28): 第十九条 由一方婚前承租、婚后用共同财产购买的房屋,房屋权属证书登记在一方名下的,应当认定为夫妻共同财产。
|
18 |
+
3. 最高人民法院关于适用《婚姻法》若干问题的解释(二)的补充规定(2017-02-28): 第二十二条 当事人结婚前,父母为双方购置房屋出资的,该出资应当认定为对自己子女的个人赠与,但父母明确表示赠与双方的除外。当事人结婚后,父母为双方购置房屋出资的,该出资应当认定为对夫妻双方的赠与,但父母明确表示赠与一方的除外。
|
19 |
+
|
20 |
+
> 请问民间借贷的利息有什么限制
|
21 |
+
|
22 |
+
1. 合同法(1999-03-15): 第二百零六条 借款人应当按照约定的期限返还借款。对借款期限没有约定或者约定不明确,依照本法第六十一条的规定仍不能确定的,借款人可以随时返还;贷款人可以催告借款人在合理期限内返还。
|
23 |
+
2. 合同法(1999-03-15): 第二百零五条 借款人应当按照约定的期限支付利息。对支付利息的期限没有约定或者约定不明确,依照本法第六十一条的规定仍不能确定,借款期间不满一年的,应当在返还借款时一并支付;借款期间一年以上的,应当在每届满一年时支付,剩余期间不满一年的,应当在返还借款时一并支付。
|
24 |
+
3. 最高人民法院关于审理民间借贷案件适用法律若干问题的规定(2020-08-19): 第二十六条 出借人请求借款人按照合同约定利率支付利息的,人民法院应予支持,但是双方约定的利率超过合同成立时一年期贷款市场报价利率四倍的除外。前款所称“一年期贷款市场报价利率”,是指中国人民银行授权全国银行间同业拆借中心自2019年8月20日起每月发布的一年期贷款市场报价利率。
|
25 |
+
|
26 |
+
# Usage
|
27 |
+
|
28 |
+
```python
|
29 |
+
from sentence_transformers import SentenceTransformer, LoggingHandler, losses, models, util
|
30 |
+
from sentence_transformers.util import cos_sim
|
31 |
+
|
32 |
+
|
33 |
+
model_path = "your_model_path"
|
34 |
+
model = SentenceTransformer(model_path).cuda()
|
35 |
+
|
36 |
+
sentence1 = "合同法(1999-03-15): 第二百零六条 借款人应当按照约定的期限返还借款。对借款期限没有约定或者约定不明确,依照本法第六十一条的规定仍不能确定的,借款人可以随时返还;贷款人可以催告借款人在合理期限内返还。"
|
37 |
+
|
38 |
+
sentence2 = "请问如果借款没还怎么办。"
|
39 |
+
|
40 |
+
encoded_sentence1 = model.encode(sentence1)
|
41 |
+
|
42 |
+
encoded_sentence2 = model.encode(sentence2)
|
43 |
+
|
44 |
+
print(cos_sim(encoded_sentence1, encoded_sentence2))
|
45 |
+
|
46 |
+
# tensor([[0.9960]])
|
47 |
+
```
|
config.json
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/remote-home/panda/rikka/text2vec-roberta-512",
|
3 |
+
"architectures": [
|
4 |
+
"BertModel"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"bos_token_id": 0,
|
8 |
+
"classifier_dropout": null,
|
9 |
+
"directionality": "bidi",
|
10 |
+
"eos_token_id": 2,
|
11 |
+
"hidden_act": "gelu",
|
12 |
+
"hidden_dropout_prob": 0.1,
|
13 |
+
"hidden_size": 768,
|
14 |
+
"initializer_range": 0.02,
|
15 |
+
"intermediate_size": 3072,
|
16 |
+
"layer_norm_eps": 1e-12,
|
17 |
+
"max_position_embeddings": 512,
|
18 |
+
"model_type": "bert",
|
19 |
+
"num_attention_heads": 12,
|
20 |
+
"num_hidden_layers": 12,
|
21 |
+
"output_past": true,
|
22 |
+
"pad_token_id": 0,
|
23 |
+
"pooler_fc_size": 768,
|
24 |
+
"pooler_num_attention_heads": 12,
|
25 |
+
"pooler_num_fc_layers": 3,
|
26 |
+
"pooler_size_per_head": 128,
|
27 |
+
"pooler_type": "first_token_transform",
|
28 |
+
"position_embedding_type": "absolute",
|
29 |
+
"torch_dtype": "float32",
|
30 |
+
"transformers_version": "4.30.2",
|
31 |
+
"type_vocab_size": 2,
|
32 |
+
"use_cache": true,
|
33 |
+
"vocab_size": 21128
|
34 |
+
}
|
config_sentence_transformers.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"__version__": {
|
3 |
+
"sentence_transformers": "2.2.2",
|
4 |
+
"transformers": "4.30.2",
|
5 |
+
"pytorch": "2.0.1+cu117"
|
6 |
+
}
|
7 |
+
}
|
modules.json
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"idx": 0,
|
4 |
+
"name": "0",
|
5 |
+
"path": "",
|
6 |
+
"type": "sentence_transformers.models.Transformer"
|
7 |
+
},
|
8 |
+
{
|
9 |
+
"idx": 1,
|
10 |
+
"name": "1",
|
11 |
+
"path": "1_Pooling",
|
12 |
+
"type": "sentence_transformers.models.Pooling"
|
13 |
+
}
|
14 |
+
]
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:561f7702b92038ccfde7283e13cf07215276139f2b33c7ce6958658752bcc8f5
|
3 |
+
size 409141805
|
sentence_bert_config.json
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"max_seq_length": 512,
|
3 |
+
"do_lower_case": false
|
4 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cls_token": "[CLS]",
|
3 |
+
"mask_token": "[MASK]",
|
4 |
+
"pad_token": "[PAD]",
|
5 |
+
"sep_token": "[SEP]",
|
6 |
+
"unk_token": "[UNK]"
|
7 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"clean_up_tokenization_spaces": true,
|
3 |
+
"cls_token": "[CLS]",
|
4 |
+
"do_lower_case": true,
|
5 |
+
"mask_token": "[MASK]",
|
6 |
+
"model_max_length": 1000000000000000019884624838656,
|
7 |
+
"pad_token": "[PAD]",
|
8 |
+
"sep_token": "[SEP]",
|
9 |
+
"strip_accents": null,
|
10 |
+
"tokenize_chinese_chars": true,
|
11 |
+
"tokenizer_class": "BertTokenizer",
|
12 |
+
"unk_token": "[UNK]"
|
13 |
+
}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|