File size: 1,938 Bytes
c32c623
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cdcf619
c32c623
 
 
 
 
cdcf619
c32c623
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cdcf619
c32c623
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
license: apache-2.0
language:
- en
base_model:
- distilbert/distilbert-base-uncased
pipeline_tag: text-ranking
---
# Model Card for Model ID

<!-- Provide a quick summary of what the model is/does. -->

This is a text Reranker model to score if a text is kindergarten-teacher style.

## Model Details

### Model Description

<!-- Provide a longer summary of what this model is. -->

- **Developed by:** Miao025
- **Model type:** Text Reranking
- **Model size:** 67M params
- **Language(s) (NLP):** English
- **License:** apache-2.0
- **Finetuned from model [optional]:** distilbert/distilbert-base-uncased
- **Demo:** [A fine-tuned AI KinderChatbot using this Rerank model](https://huggingface.co/spaces/Miao025/qwen-kinderchatbot)


## Useage

<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->

```
from transformers import AutoTokenizer, AutoModelForCausalLM

# Load tokenizer and reranker model (Note that you can also download the models and load with local path.)
tokenizer_reward = AutoTokenizer.from_pretrained("Miao025/Qwen-KinderChatbot-Reward")
reward_model = AutoModelForSequenceClassification.from_pretrained("Miao025/Qwen-KinderChatbot-Reward")

# For each prompt-response pair, get the score
inputs = tokenizer_reward(prompt, response, return_tensors="pt", truncation=True)
with torch.no_grad():
    logits = reward_model(**inputs).logits
    score = torch.softmax(logits, dim=-1)[0,1].item()
```

## Training Data

<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->

[Training Dataset Card](to be add)
Training process can be found on [Github](https://github.com/Miao025/KinderChatbot).

## Contact
For any questions, please contact the author yinmiao025@gmail.com