Dongfu Jiang commited on
Commit
02d2380
1 Parent(s): adad0ff

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -3
README.md CHANGED
@@ -81,9 +81,24 @@ blender_config = llm_blender.BlenderConfig()
81
  blender_config.device = "cuda" # blender ranker and fuser device
82
  blender = llm_blender.Blender(blender_config, ranker_config, fuser_config)
83
  ```
84
- Then you are good to use pairrankers with
85
- - `blender.rank()` to rank candidates
86
- - `blender.compare()` to compare 2 candiates.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  See LLM-Blender Github [README.md](https://github.com/yuchenlin/LLM-Blender#rank-and-fusion)
88
  and jupyter file [blender_usage.ipynb](https://github.com/yuchenlin/LLM-Blender/blob/main/blender_usage.ipynb)
89
  for detailed usage examples.
 
81
  blender_config.device = "cuda" # blender ranker and fuser device
82
  blender = llm_blender.Blender(blender_config, ranker_config, fuser_config)
83
  ```
84
+
85
+ - Then you can rank candidates with the following function
86
+
87
+ ```python
88
+ inputs = ["input1", "input2"]
89
+ candidates_texts = [["candidate1 for input1", "candidatefor input1"], ["candidate1 for input2", "candidate2 for input2"]]
90
+ ranks = blender.rank(inputs, candidates_texts, return_scores=False, batch_size=2)
91
+ # ranks is a list of ranks where ranks[i][j] represents the ranks of candidate-j for input-i
92
+ ```
93
+
94
+ - Using pairranker to directly compare two candidates
95
+ ```python
96
+ candidates_A = [cands[0] for cands in candidates]
97
+ candidates_B = [cands[1] for cands in candidates]
98
+ comparison_results = blender.compare(inputs, candidates_A, candidates_B)
99
+ # comparison_results is a list of bool, where element[i] denotes whether candidates_A[i] is better than candidates_B[i] for inputs[i]
100
+ ```
101
+
102
  See LLM-Blender Github [README.md](https://github.com/yuchenlin/LLM-Blender#rank-and-fusion)
103
  and jupyter file [blender_usage.ipynb](https://github.com/yuchenlin/LLM-Blender/blob/main/blender_usage.ipynb)
104
  for detailed usage examples.