Views
No views yet
| Model | T2Retrieval | MMarcoRetrieval | DuRetrieval | CovidRetrieval | CmedqaRetrieval | EcomRetrieval | MedicalRetrieval | VideoRetrieval | Avg |
|---|---|---|---|---|---|---|---|---|---|
| 360Zhinao-search | 87.12 | 83.32 | 87.57 | 85.02 | 46.73 | 68.9 | 63.69 | 78.09 | 75.05 |
| AGE_Hybrid | 86.88 | 80.65 | 89.28 | 83.66 | 47.26 | 69.28 | 65.94 | 76.79 | 74.97 |
| OpenSearch-text-hybrid | 86.76 | 79.93 | 87.85 | 84.03 | 46.56 | 68.79 | 65.92 | 75.43 | 74.41 |
| piccolo-large-zh-v2 | 86.14 | 79.54 | 89.14 | 86.78 | 47.58 | 67.75 | 64.88 | 73.1 | 74.36 |
| stella-large-zh-v3-1792d | 85.56 | 79.14 | 87.13 | 82.44 | 46.87 | 68.62 | 65.18 | 73.89 | 73.6 |
1from typing import cast, List, Dict, Union
2from transformers import AutoModel, AutoTokenizer
3import torch
4import numpy as np
5
6tokenizer = AutoTokenizer.from_pretrained('qihoo360/360Zhinao-search')
7model = AutoModel.from_pretrained('qihoo360/360Zhinao-search')
8sentences = ['天空是什么颜色的', '天空是蓝色的']
9inputs = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt', max_length=512)
10
11if __name__ == "__main__":
12
13 with torch.no_grad():
14 last_hidden_state = model(**inputs, return_dict=True).last_hidden_state
15 embeddings = last_hidden_state[:, 0]
16 embeddings = torch.nn.functional.normalize(embeddings, dim=-1)
17 embeddings = embeddings.cpu().numpy()
18
19 print("embeddings:")
20 print(embeddings)
21
22 cos_sim = np.dot(embeddings[0], embeddings[1])
23 print("cos_sim:", cos_sim)
24