初始化项目,由ModelHub XC社区提供模型
Model: ContextualAI/ctxl-rerank-v2-instruct-multilingual-6b Source: Original Platform
This commit is contained in:
37
.gitattributes
vendored
Normal file
37
.gitattributes
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
main_benchmark.png filter=lfs diff=lfs merge=lfs -text
|
||||
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||
5
1_LogitScore/config.json
Normal file
5
1_LogitScore/config.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"true_token_id": 0,
|
||||
"false_token_id": null,
|
||||
"module_input_name": "causal_logits"
|
||||
}
|
||||
BIN
Contextual_AI_Brand_Mark_Dark.png
Normal file
BIN
Contextual_AI_Brand_Mark_Dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
277
README.md
Normal file
277
README.md
Normal file
@@ -0,0 +1,277 @@
|
||||
---
|
||||
library_name: transformers
|
||||
license: cc-by-nc-sa-4.0
|
||||
pipeline_tag: text-ranking
|
||||
tags:
|
||||
- sentence-transformers
|
||||
- cross-encoder
|
||||
- reranker
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
|
||||
# Contextual AI Reranker v2 6B
|
||||
|
||||
<img src="Contextual_AI_Brand_Mark_Dark.png" width="10%" alt="Contextual_AI"/>
|
||||
|
||||
[](https://contextual.ai/blog/rerank-v2)
|
||||
[](https://huggingface.co/collections/ContextualAI/contextual-ai-reranker-v2)
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
## Highlights
|
||||
|
||||
Contextual AI's reranker is the **first instruction-following reranker** capable of handling retrieval conflicts and ranking with custom instructions (e.g., prioritizing recent information). It achieves state-of-the-art performance on BEIR and sits on the cost/performance Pareto frontier across:
|
||||
|
||||
- Instruction following
|
||||
- Question answering
|
||||
- Multilinguality (100+ languages)
|
||||
- Product search & recommendation
|
||||
- Real-world use cases
|
||||
|
||||
<p align="center">
|
||||
<img src="main_benchmark.png" width="1200"/>
|
||||
<p>
|
||||
|
||||
For detailed benchmarks, see our [blog post](https://contextual.ai/blog/rerank-v2).
|
||||
|
||||
## Overview
|
||||
|
||||
- **Model Type**: Text Reranking
|
||||
- **Supported Languages**: 100+
|
||||
- **Parameters**: 6B
|
||||
- **Context Length**: up to 32K
|
||||
|
||||
## When to Use This Model
|
||||
|
||||
Use this reranker when you need to:
|
||||
- Re-rank retrieved documents with custom instructions
|
||||
- Handle conflicting information in retrieval results
|
||||
- Prioritize documents by recency or other criteria
|
||||
- Support multilingual search (100+ languages)
|
||||
- Process long contexts (up to 32K tokens)
|
||||
|
||||
## Quickstart
|
||||
|
||||
Each path below uses the same example inputs:
|
||||
|
||||
```
|
||||
Query: What are the health benefits of exercise?
|
||||
Instruction: Prioritize recent medical research
|
||||
Documents:
|
||||
- Regular exercise reduces risk of heart disease and improves mental health.
|
||||
- A 2024 study shows exercise enhances cognitive function in older adults.
|
||||
- Ancient Greeks valued physical fitness for military training.
|
||||
```
|
||||
|
||||
**Expected Output:**
|
||||
```
|
||||
Score: -2.2969 | Doc: A 2024 study shows exercise enhances cognitive function in older adults.
|
||||
Score: -4.6875 | Doc: Regular exercise reduces risk of heart disease and improves mental health.
|
||||
Score: -12.3750 | Doc: Ancient Greeks valued physical fitness for military training.
|
||||
```
|
||||
|
||||
### Using Sentence Transformers
|
||||
|
||||
Install Sentence Transformers:
|
||||
```bash
|
||||
pip install sentence_transformers
|
||||
```
|
||||
|
||||
```python
|
||||
import torch
|
||||
from sentence_transformers import CrossEncoder
|
||||
|
||||
model = CrossEncoder("ContextualAI/ctxl-rerank-v2-instruct-multilingual-6b", model_kwargs={"dtype": torch.bfloat16})
|
||||
|
||||
query = "What are the health benefits of exercise?"
|
||||
instruction = "Prioritize recent medical research"
|
||||
documents = [
|
||||
"Regular exercise reduces risk of heart disease and improves mental health.",
|
||||
"A 2024 study shows exercise enhances cognitive function in older adults.",
|
||||
"Ancient Greeks valued physical fitness for military training.",
|
||||
]
|
||||
|
||||
pairs = [(query, doc) for doc in documents]
|
||||
scores = model.predict(pairs, prompt=instruction)
|
||||
print(scores)
|
||||
# [ -4.6875 -2.171875 -12.4375 ]
|
||||
|
||||
rankings = model.rank(query, documents, prompt=instruction)
|
||||
print(rankings)
|
||||
# [{'corpus_id': 1, 'score': np.float32(-2.171875)}, {'corpus_id': 0, 'score': np.float32(-4.6875)}, {'corpus_id': 2, 'score': np.float32(-12.4375)}]
|
||||
```
|
||||
|
||||
The `prompt` argument is optional, you can omit it to score pairs without any custom instruction. Scores are the raw bfloat16 logits at token id 0 at the final position (matching the `Transformers` path below), so higher means more relevant.
|
||||
|
||||
### vLLM Usage (Recommended for Production)
|
||||
|
||||
Requires `vllm==0.10.0` for NVFP4 or `vllm>=0.8.5` for BF16.
|
||||
|
||||
```python
|
||||
import os
|
||||
os.environ['VLLM_USE_V1'] = '0' # v1 engine doesn't support logits processor yet
|
||||
|
||||
import torch
|
||||
from vllm import LLM, SamplingParams
|
||||
|
||||
|
||||
def logits_processor(_, scores):
|
||||
"""Custom logits processor for vLLM reranking."""
|
||||
index = scores[0].view(torch.uint16)
|
||||
scores = torch.full_like(scores, float("-inf"))
|
||||
scores[index] = 1
|
||||
return scores
|
||||
|
||||
|
||||
def format_prompts(query: str, instruction: str, documents: list[str]) -> list[str]:
|
||||
"""Format query and documents into prompts for reranking."""
|
||||
if instruction:
|
||||
instruction = f" {instruction}"
|
||||
prompts = []
|
||||
for doc in documents:
|
||||
prompt = f"Check whether a given document contains information helpful to answer the query.\n<Document> {doc}\n<Query> {query}{instruction} ??"
|
||||
prompts.append(prompt)
|
||||
return prompts
|
||||
|
||||
|
||||
def infer_w_vllm(model_path: str, query: str, instruction: str, documents: list[str]):
|
||||
model = LLM(
|
||||
model=model_path,
|
||||
gpu_memory_utilization=0.85,
|
||||
max_model_len=8192,
|
||||
dtype="bfloat16",
|
||||
max_logprobs=2,
|
||||
max_num_batched_tokens=262144,
|
||||
)
|
||||
sampling_params = SamplingParams(
|
||||
temperature=0,
|
||||
max_tokens=1,
|
||||
logits_processors=[logits_processor]
|
||||
)
|
||||
prompts = format_prompts(query, instruction, documents)
|
||||
|
||||
outputs = model.generate(prompts, sampling_params, use_tqdm=False)
|
||||
|
||||
# Extract scores and create results
|
||||
results = []
|
||||
for i, output in enumerate(outputs):
|
||||
score = (
|
||||
torch.tensor([output.outputs[0].token_ids[0]], dtype=torch.uint16)
|
||||
.view(torch.bfloat16)
|
||||
.item()
|
||||
)
|
||||
results.append((score, i, documents[i]))
|
||||
|
||||
# Sort by score (descending)
|
||||
results = sorted(results, key=lambda x: x[0], reverse=True)
|
||||
|
||||
print(f"Query: {query}")
|
||||
print(f"Instruction: {instruction}")
|
||||
for score, doc_id, doc in results:
|
||||
print(f"Score: {score:.4f} | Doc: {doc}")
|
||||
|
||||
|
||||
# Example usage
|
||||
if __name__ == "__main__":
|
||||
model_path = "ContextualAI/reranker_v2_6b"
|
||||
query = "What are the health benefits of exercise?"
|
||||
instruction = "Prioritize recent medical research"
|
||||
documents = [
|
||||
"Regular exercise reduces risk of heart disease and improves mental health.",
|
||||
"A 2024 study shows exercise enhances cognitive function in older adults.",
|
||||
"Ancient Greeks valued physical fitness for military training."
|
||||
]
|
||||
|
||||
infer_w_vllm(model_path, query, instruction, documents)
|
||||
```
|
||||
|
||||
|
||||
### Transformers Usage (Simpler Setup)
|
||||
|
||||
Requires `transformers>=4.51.0` for BF16. Not supported for NVFP4.
|
||||
|
||||
```python
|
||||
import torch
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||
|
||||
|
||||
def format_prompts(query: str, instruction: str, documents: list[str]) -> list[str]:
|
||||
"""Format query and documents into prompts for reranking."""
|
||||
if instruction:
|
||||
instruction = f" {instruction}"
|
||||
prompts = []
|
||||
for doc in documents:
|
||||
prompt = f"Check whether a given document contains information helpful to answer the query.\n<Document> {doc}\n<Query> {query}{instruction} ??"
|
||||
prompts.append(prompt)
|
||||
return prompts
|
||||
|
||||
|
||||
def infer_w_hf(model_path: str, query: str, instruction: str, documents: list[str]):
|
||||
device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||
dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=True)
|
||||
if tokenizer.pad_token is None:
|
||||
tokenizer.pad_token = tokenizer.eos_token
|
||||
tokenizer.padding_side = "left" # so -1 is the real last token for all prompts
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=dtype).to(device)
|
||||
model.eval()
|
||||
|
||||
prompts = format_prompts(query, instruction, documents)
|
||||
enc = tokenizer(
|
||||
prompts,
|
||||
return_tensors="pt",
|
||||
padding=True,
|
||||
truncation=True,
|
||||
)
|
||||
input_ids = enc["input_ids"].to(device)
|
||||
attention_mask = enc["attention_mask"].to(device)
|
||||
|
||||
with torch.no_grad():
|
||||
out = model(input_ids=input_ids, attention_mask=attention_mask)
|
||||
|
||||
next_logits = out.logits[:, -1, :] # [batch, vocab]
|
||||
|
||||
scores_bf16 = next_logits[:, 0].to(torch.bfloat16)
|
||||
scores = scores_bf16.float().tolist()
|
||||
|
||||
# Sort by score (descending)
|
||||
results = sorted([(s, i, documents[i]) for i, s in enumerate(scores)], key=lambda x: x[0], reverse=True)
|
||||
|
||||
print(f"Query: {query}")
|
||||
print(f"Instruction: {instruction}")
|
||||
for score, doc_id, doc in results:
|
||||
print(f"Score: {score:.4f} | Doc: {doc}")
|
||||
"""
|
||||
Query: What are the health benefits of exercise?
|
||||
Instruction: Prioritize recent medical research
|
||||
Score: -2.1719 | Doc: A 2024 study shows exercise enhances cognitive function in older adults.
|
||||
Score: -4.6875 | Doc: Regular exercise reduces risk of heart disease and improves mental health.
|
||||
Score: -12.4375 | Doc: Ancient Greeks valued physical fitness for military training.
|
||||
"""
|
||||
```
|
||||
|
||||
## Citation
|
||||
|
||||
If you use this model, please cite:
|
||||
|
||||
```bibtex
|
||||
@misc{ctxl_rerank_v2_instruct_multilingual,
|
||||
title={Contextual AI Reranker v2},
|
||||
author={Halal, George and Agrawal, Sheshansh},
|
||||
year={2025},
|
||||
url={https://contextual.ai/blog/rerank-v2},
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Creative Commons Attribution Non Commercial Share Alike 4.0 (cc-by-nc-sa-4.0)
|
||||
|
||||
## Contact
|
||||
|
||||
For questions or issues, please open an issue on the model repository.
|
||||
7
chat_template.jinja
Normal file
7
chat_template.jinja
Normal file
@@ -0,0 +1,7 @@
|
||||
{%- set instruction_text = messages | selectattr("role", "eq", "system") | map(attribute="content") | first | default("") -%}
|
||||
{%- set query_text = messages | selectattr("role", "eq", "query") | map(attribute="content") | first -%}
|
||||
{%- set document_text = messages | selectattr("role", "eq", "document") | map(attribute="content") | first -%}
|
||||
{{- bos_token -}}
|
||||
Check whether a given document contains information helpful to answer the query.
|
||||
<Document> {{ document_text }}
|
||||
<Query> {{ query_text }}{% if instruction_text %} {{ instruction_text }}{% endif %} ??
|
||||
32
config.json
Normal file
32
config.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"architectures": [
|
||||
"MistralForCausalLM"
|
||||
],
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"head_dim": 128,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 5120,
|
||||
"id2label": {
|
||||
"0": "LABEL_0"
|
||||
},
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 14336,
|
||||
"label2id": {
|
||||
"LABEL_0": 0
|
||||
},
|
||||
"max_position_embeddings": 1024000,
|
||||
"model_type": "mistral",
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 20,
|
||||
"num_key_value_heads": 8,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_theta": 1000000.0,
|
||||
"sliding_window": null,
|
||||
"tie_word_embeddings": false,
|
||||
"torch_dtype": "bfloat16",
|
||||
"transformers_version": "4.51.3",
|
||||
"use_cache": true,
|
||||
"vocab_size": 131072
|
||||
}
|
||||
11
config_sentence_transformers.json
Normal file
11
config_sentence_transformers.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"__version__": {
|
||||
"pytorch": "2.10.0+cu128",
|
||||
"sentence_transformers": "5.4.0",
|
||||
"transformers": "5.5.0.dev0"
|
||||
},
|
||||
"activation_fn": "torch.nn.modules.linear.Identity",
|
||||
"default_prompt_name": null,
|
||||
"model_type": "CrossEncoder",
|
||||
"prompts": {}
|
||||
}
|
||||
6
generation_config.json
Normal file
6
generation_config.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"_from_model_config": true,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"transformers_version": "4.51.3"
|
||||
}
|
||||
3
main_benchmark.png
Normal file
3
main_benchmark.png
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:73b74cd012b57c5f8e8abfac5135359af7e2758ddaa76f3c05e8ff47de202c84
|
||||
size 154196
|
||||
3
model-00001-of-00004.safetensors
Normal file
3
model-00001-of-00004.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2465871762bc01184085f9109bc43502bce735e9a778d9b08951f309291db69c
|
||||
size 4865522496
|
||||
3
model-00002-of-00004.safetensors
Normal file
3
model-00002-of-00004.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:accf737a92b0504ffa7032f372f0a0b11135be28284131ddc9006feee4e2f11d
|
||||
size 4907529424
|
||||
3
model-00003-of-00004.safetensors
Normal file
3
model-00003-of-00004.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6d4d775b666ac606e92f121d4dcfded4bba72628374f72abbaacf72efc6eaee9
|
||||
size 2474756752
|
||||
3
model-00004-of-00004.safetensors
Normal file
3
model-00004-of-00004.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fff2ef6c64625c518b8388f86c6c3cee57aad1fdad4f7f33878f7b0218f1473f
|
||||
size 2684354688
|
||||
190
model.safetensors.index.json
Normal file
190
model.safetensors.index.json
Normal file
@@ -0,0 +1,190 @@
|
||||
{
|
||||
"metadata": {
|
||||
"total_size": 14932142080
|
||||
},
|
||||
"weight_map": {
|
||||
"lm_head.weight": "model-00004-of-00004.safetensors",
|
||||
"model.embed_tokens.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.0.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.0.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.0.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.0.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.1.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.1.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.1.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.1.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.10.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.10.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.10.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.10.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.10.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.10.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.10.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.10.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.10.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.11.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.11.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.11.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.11.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.11.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.11.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.11.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.11.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.11.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.12.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.12.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.12.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.12.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.12.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.12.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.12.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.12.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.12.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.13.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.13.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.13.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.13.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.13.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.13.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.13.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.13.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.13.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.14.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.14.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.14.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.14.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.14.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.14.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.14.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.14.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.14.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.15.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.15.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.15.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.15.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.15.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.15.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.15.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.15.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.15.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.16.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.16.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.16.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.16.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.16.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.16.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.16.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.16.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.16.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.17.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.17.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.17.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.17.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.17.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.17.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.17.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.17.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.17.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.18.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.18.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.18.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.18.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.18.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.18.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.18.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.18.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.18.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.19.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.19.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.19.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.19.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.19.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.19.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.19.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.19.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.19.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
||||
"model.layers.2.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.2.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.2.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.2.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.3.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.3.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.3.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.3.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.3.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.3.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.3.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.3.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.3.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.4.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.4.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.4.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.4.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.4.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.4.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.4.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.4.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.4.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.5.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.5.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.5.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.5.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.5.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.5.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.5.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.5.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.5.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.6.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.6.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.6.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.6.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.6.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.6.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.6.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.6.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.6.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
||||
"model.layers.7.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.7.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.7.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.7.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.7.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.7.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.7.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.7.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.7.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.8.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.8.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.8.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.8.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.8.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.8.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.8.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.8.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.8.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.9.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.9.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.9.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.9.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.9.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.9.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.9.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.9.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.layers.9.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
||||
"model.norm.weight": "model-00003-of-00004.safetensors"
|
||||
}
|
||||
}
|
||||
14
modules.json
Normal file
14
modules.json
Normal file
@@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"idx": 0,
|
||||
"name": "0",
|
||||
"path": "",
|
||||
"type": "sentence_transformers.base.modules.transformer.Transformer"
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"name": "1",
|
||||
"path": "1_LogitScore",
|
||||
"type": "sentence_transformers.cross_encoder.modules.logit_score.LogitScore"
|
||||
}
|
||||
]
|
||||
15
sentence_bert_config.json
Normal file
15
sentence_bert_config.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"transformer_task": "text-generation",
|
||||
"modality_config": {
|
||||
"text": {
|
||||
"method": "forward",
|
||||
"method_output_name": "logits"
|
||||
},
|
||||
"message": {
|
||||
"method": "forward",
|
||||
"method_output_name": "logits",
|
||||
"format": "flat"
|
||||
}
|
||||
},
|
||||
"module_output_name": "causal_logits"
|
||||
}
|
||||
24
special_tokens_map.json
Normal file
24
special_tokens_map.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"bos_token": {
|
||||
"content": "<s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"eos_token": {
|
||||
"content": "</s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"pad_token": "<pad>",
|
||||
"unk_token": {
|
||||
"content": "<unk>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
}
|
||||
}
|
||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b0240ce510f08e6c2041724e9043e33be9d251d1e4a4d94eb68cd47b954b61d2
|
||||
size 17078292
|
||||
8015
tokenizer_config.json
Normal file
8015
tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user