zyznull commited on
Commit
4e206fc
1 Parent(s): abde25b

upload model

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,56 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RankingGPT-bloom-560m
2
+
3
+ RankingGPT is a text ranker based on large language models with significant in-domain and out-domain effectiveness.
4
+ We provide RankingGPT in different sizes and types, including bloom-560m, bloom-1b1, bloom-3b, bloom-7b, llama2-7b, baichuan2-7b and qwen-7b.
5
+
6
+ More details please refer to our [paper](https://arxiv.org/abs/2311.16720) and [github](https://github.com/Alibaba-NLP/RankingGPT).
7
+
8
+
9
+ ## Usage
10
+
11
+ Code example
12
+ ```python
13
+ import torch
14
+ from transformers import AutoTokenizer, AutoModelForCausalLM
15
+
16
+ tokenizer = AutoTokenizer.from_pretrained('RankingGPT-bloom-560m')
17
+ model = AutoModelForCausalLM.from_pretrained('RankingGPT-bloom-560m').eval()
18
+
19
+ query='when should a baby walk'
20
+ document='Most babies start to walk around 13 months, but your baby may start walking as early as 9 or 10 months or as late as 15 or 16 months.'
21
+
22
+ context=f'Document: {document} Query:'
23
+ example=context+query
24
+
25
+ context_enc = tokenizer.encode(context, add_special_tokens=False)
26
+ continuation_enc = tokenizer.encode(query, add_special_tokens=False)
27
+ model_input = torch.tensor(context_enc+continuation_enc[:-1])
28
+ continuation_len = len(continuation_enc)
29
+ input_len, = model_input.shape
30
+
31
+
32
+ with torch.no_grad():
33
+ logprobs = torch.nn.functional.log_softmax(model(model_input.unsqueeze(dim=0))[0], dim=-1)[0]
34
+
35
+ logprobs = logprobs[input_len-continuation_len:]
36
+ logprobs = torch.gather(logprobs, 1, torch.tensor(continuation_enc).unsqueeze(-1)).squeeze(-1)
37
+ score = torch.sum(logprobs)/logprobs.shape[0]
38
+
39
+ print(f"Document: {document[:20] + '...'} Score: {score}")
40
+ ```
41
+
42
+
43
+ ### Citation
44
+
45
+ If you find our paper or models helpful, please consider citing them as follows:
46
+
47
+ ```
48
+ @misc{zhang2023rankinggpt,
49
+ title={RankingGPT: Empowering Large Language Models in Text Ranking with Progressive Enhancement},
50
+ author={Longhui Zhang and Yanzhao Zhang and Dingkun Long and Pengjun Xie and Meishan Zhang and Min Zhang},
51
+ year={2023},
52
+ eprint={2311.16720},
53
+ archivePrefix={arXiv},
54
+ primaryClass={cs.IR}
55
+ }
56
+ ```
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "bigscience/bloom-560m",
3
+ "apply_residual_connection_post_layernorm": false,
4
+ "architectures": [
5
+ "BloomForCausalLM"
6
+ ],
7
+ "attention_dropout": 0.0,
8
+ "attention_softmax_in_fp32": true,
9
+ "bias_dropout_fusion": true,
10
+ "bos_token_id": 1,
11
+ "eos_token_id": 2,
12
+ "hidden_dropout": 0.0,
13
+ "hidden_size": 1024,
14
+ "initializer_range": 0.02,
15
+ "layer_norm_epsilon": 1e-05,
16
+ "masked_softmax_fusion": true,
17
+ "model_type": "bloom",
18
+ "n_head": 16,
19
+ "n_inner": null,
20
+ "n_layer": 24,
21
+ "offset_alibi": 100,
22
+ "pad_token_id": 3,
23
+ "pretraining_tp": 1,
24
+ "skip_bias_add": true,
25
+ "skip_bias_add_qkv": false,
26
+ "slow_but_exact": false,
27
+ "torch_dtype": "float32",
28
+ "transformers_version": "4.29.0",
29
+ "unk_token_id": 0,
30
+ "use_cache": true,
31
+ "vocab_size": 250880
32
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "pad_token_id": 3,
6
+ "transformers_version": "4.29.0"
7
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:daff937349f9c8bbc30bb810544328c0fa1bb4ba95537c32d08b3696e744d2fd
3
+ size 2236951031
special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "eos_token": "</s>",
4
+ "pad_token": "<pad>",
5
+ "unk_token": "<unk>"
6
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f6efc66e73f1fd69da4f436e48befb519fdff3fe18910850c1d41bd862293a5
3
+ size 14500443
tokenizer_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "bos_token": "<s>",
4
+ "clean_up_tokenization_spaces": false,
5
+ "eos_token": "</s>",
6
+ "model_max_length": 512,
7
+ "pad_token": "<pad>",
8
+ "padding_side": "right",
9
+ "tokenizer_class": "BloomTokenizer",
10
+ "unk_token": "<unk>"
11
+ }