Kogero commited on
Commit
be27db8
·
verified ·
1 Parent(s): 47204cf

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +58 -0
README.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: mit
4
+ datasets:
5
+ - microsoft/ms_marco
6
+ tags:
7
+ - dual-encoder
8
+ - two-tower
9
+ - neural-ir
10
+ - information-retrieval
11
+ ---
12
+
13
+ # MS MARCO Dual Encoder Model
14
+
15
+ This repository contains a Dual Encoder (Two-Tower) model trained on the Microsoft MS MARCO dataset for information retrieval tasks.
16
+
17
+ ## Model Details
18
+
19
+ - **Architecture**: Two-Tower (Dual Encoder)
20
+ - **Embedding Dimension**: 128
21
+ - **Training Strategy**: Triplet loss with margin 0.2
22
+ - **Vocabulary Size**: 50,001
23
+ - **Dataset Size**: 5,000
24
+ - **Parameters**:
25
+ - Query Tower: 16,512
26
+ - Document Tower: 16,512
27
+ - Total: 33,024
28
+ - **Training Device**: cuda
29
+
30
+ ## Usage
31
+
32
+ ```python
33
+ import torch
34
+ from model import QryTower, DocTower
35
+
36
+ # Load the models
37
+ embedding_dim = 128
38
+ qry_model = QryTower(embedding_dim)
39
+ doc_model = DocTower(embedding_dim)
40
+
41
+ qry_model.load_state_dict(torch.load("qry_tower.pth"))
42
+ doc_model.load_state_dict(torch.load("doc_tower.pth"))
43
+
44
+ # Get embeddings for query and document
45
+ query_embedding = qry_model(preprocessed_query)
46
+ document_embedding = doc_model(preprocessed_document)
47
+
48
+ # Calculate similarity
49
+ similarity = torch.cosine_similarity(query_embedding, document_embedding)
50
+ ```
51
+
52
+ ## Training
53
+
54
+ This model was trained for 5 epochs with a batch size of 32 and learning rate of 0.001.
55
+
56
+ ## License
57
+
58
+ MIT