Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1 |
---
|
2 |
language:
|
3 |
- zh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
# Model Card for Model ID
|
6 |
|
@@ -10,21 +18,32 @@ This modelcard aims to be a base template for new models. It has been generated
|
|
10 |
|
11 |
## Model Details
|
12 |
We propose the PEG model (a Progressively Learned Textual Embedding), which progressively adjusts the weights of samples contributing to the loss within an extremely large batch, based on the difficulty levels of negative samples.
|
13 |
-
|
14 |
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
- **Demo [optional]:** [More Information Needed]
|
23 |
-
|
24 |
-
## Uses
|
25 |
-
|
26 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
27 |
|
|
|
|
|
|
|
|
|
28 |
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
language:
|
3 |
- zh
|
4 |
+
pipeline_tag: sentence-similarity
|
5 |
+
tags:
|
6 |
+
- PEG
|
7 |
+
- feature-extraction
|
8 |
+
- sentence-similarity
|
9 |
+
- transformers
|
10 |
+
license: apache-2.0
|
11 |
+
library_name: transformers
|
12 |
---
|
13 |
# Model Card for Model ID
|
14 |
|
|
|
18 |
|
19 |
## Model Details
|
20 |
We propose the PEG model (a Progressively Learned Textual Embedding), which progressively adjusts the weights of samples contributing to the loss within an extremely large batch, based on the difficulty levels of negative samples.
|
21 |
+
we have amassed an extensive collection of over 110 million data, spanning a wide range of fields such as general knowledge, finance, tourism, medicine, and more.
|
22 |
|
23 |
|
24 |
+
## Usage (HuggingFace Transformers)
|
25 |
|
26 |
+
Install transformers:
|
27 |
+
```
|
28 |
+
pip install transformers
|
29 |
+
```
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
Then load model and predict:
|
32 |
+
```python
|
33 |
+
from transformers import AutoModel, AutoTokenizer
|
34 |
+
import torch
|
35 |
|
36 |
|
37 |
+
# Load model from HuggingFace Hub
|
38 |
+
tokenizer = AutoTokenizer.from_pretrained('TownsWu/PEG')
|
39 |
+
model = AutoModel.from_pretrained('TownsWu/PEG')
|
40 |
+
sentences = ['如何更换花呗绑定银行卡', '花呗更改绑定银行卡']
|
41 |
+
# Tokenize sentences
|
42 |
+
inputs = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
43 |
|
44 |
+
# Compute token embeddings
|
45 |
+
with torch.no_grad():
|
46 |
+
last_hidden_state = model(**inputs, return_dict=True).last_hidden_state
|
47 |
+
embeddings = last_hidden_state[:, 0]
|
48 |
+
print("embeddings:")
|
49 |
+
print(embeddings)
|