Add label2id and id2label configs

#10
1_LogitScore/config.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "true_token_id": 9693,
3
- "false_token_id": 2152
4
- }
 
 
 
 
 
README.md CHANGED
@@ -3,8 +3,6 @@ license: apache-2.0
3
  base_model:
4
  - Qwen/Qwen3-8B-Base
5
  library_name: transformers
6
- tags:
7
- - sentence-transformers
8
  pipeline_tag: text-ranking
9
  ---
10
  # Qwen3-Reranker-8B
@@ -54,55 +52,13 @@ For more details, including benchmark evaluation, hardware requirements, and inf
54
 
55
  ## Usage
56
 
57
- ### Using Sentence Transformers
58
-
59
- Install Sentence Transformers:
60
- ```bash
61
- pip install sentence_transformers
62
- ```
63
-
64
- ```python
65
- from sentence_transformers import CrossEncoder
66
-
67
- model = CrossEncoder("Qwen/Qwen3-Reranker-8B")
68
-
69
- query = "What is the capital of China?"
70
- documents = [
71
- "The capital of China is Beijing.",
72
- "Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun.",
73
- ]
74
-
75
- pairs = [(query, doc) for doc in documents]
76
- scores = model.predict(pairs)
77
- print(scores)
78
- # [ 5.0625 -14.25 ]
79
-
80
- rankings = model.rank(query, documents)
81
- print(rankings)
82
- # [{'corpus_id': 0, 'score': 5.0625}, {'corpus_id': 1, 'score': -14.25}]
83
- ```
84
-
85
- By default, scores are raw logit differences. To get 0-1 probability scores, pass a Sigmoid activation function:
86
- ```python
87
- scores = model.predict([(query, doc) for doc in documents], activation_fn=torch.nn.Sigmoid())
88
- ```
89
-
90
- The model uses a default prompt `"query"` which injects the instruction `"Given a web search query, retrieve relevant passages that answer the query"` into the chat template. You can provide a custom instruction via the `prompts` parameter:
91
- ```python
92
- model = CrossEncoder(
93
- "Qwen/Qwen3-Reranker-8B",
94
- prompts={"classification": "Classify whether the document matches the query topic"},
95
- default_prompt_name="classification",
96
- )
97
- ```
98
-
99
- ### Using Transformers
100
-
101
  With Transformers versions earlier than 4.51.0, you may encounter the following error:
102
  ```
103
  KeyError: 'qwen3'
104
  ```
105
 
 
 
106
  ```python
107
  # Requires transformers>=4.51.0
108
  import torch
 
3
  base_model:
4
  - Qwen/Qwen3-8B-Base
5
  library_name: transformers
 
 
6
  pipeline_tag: text-ranking
7
  ---
8
  # Qwen3-Reranker-8B
 
52
 
53
  ## Usage
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  With Transformers versions earlier than 4.51.0, you may encounter the following error:
56
  ```
57
  KeyError: 'qwen3'
58
  ```
59
 
60
+ ### Transformers Usage
61
+
62
  ```python
63
  # Requires transformers>=4.51.0
64
  import torch
chat_template.jinja DELETED
@@ -1,15 +0,0 @@
1
- {%- set instruction = messages | selectattr("role", "eq", "system") | map(attribute="content") | first | default("Given a web search query, retrieve relevant passages that answer the query") -%}
2
- {%- set query_text = messages | selectattr("role", "eq", "query") | map(attribute="content") | first -%}
3
- {%- set document_text = messages | selectattr("role", "eq", "document") | map(attribute="content") | first -%}
4
- <|im_start|>system
5
- Judge whether the Document meets the requirements based on the Query and the Instruct provided. Note that the answer can only be "yes" or "no".<|im_end|>
6
- <|im_start|>user
7
- <Instruct>: {{ instruction }}
8
- <Query>: {{ query_text }}
9
- <Document>: {{ document_text }}<|im_end|>
10
- <|im_start|>assistant
11
- <think>
12
-
13
- </think>
14
-
15
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
config_sentence_transformers.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "__version__": {
3
- "sentence_transformers": "5.4.0"
4
- },
5
- "activation_fn": "torch.nn.modules.linear.Identity",
6
- "default_prompt_name": "query",
7
- "model_type": "CrossEncoder",
8
- "prompts": {
9
- "query": "Given a web search query, retrieve relevant passages that answer the query"
10
- }
11
- }
 
 
 
 
 
 
 
 
 
 
 
 
modules.json DELETED
@@ -1,14 +0,0 @@
1
- [
2
- {
3
- "idx": 0,
4
- "name": "0",
5
- "path": "",
6
- "type": "sentence_transformers.base.modules.transformer.Transformer"
7
- },
8
- {
9
- "idx": 1,
10
- "name": "1",
11
- "path": "1_LogitScore",
12
- "type": "sentence_transformers.cross_encoder.modules.logit_score.LogitScore"
13
- }
14
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
sentence_bert_config.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "transformer_task": "text-generation",
3
- "modality_config": {
4
- "text": {
5
- "method": "forward",
6
- "method_output_name": "logits"
7
- },
8
- "message": {
9
- "method": "forward",
10
- "method_output_name": "logits",
11
- "format": "flat"
12
- }
13
- },
14
- "module_output_name": "causal_logits"
15
- }