rameshmoorthy commited on
Commit
15a0f20
1 Parent(s): 4d2aa11

Upload 21 files

Browse files
.ragatouille/colbert/indexes/cbseclass10index/0.codes.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c8936a0060f91a580e7be1cd2091bd33acfea4a836a6786f232dce3988f9865
3
+ size 216924
.ragatouille/colbert/indexes/cbseclass10index/0.metadata.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "passage_offset": 0,
3
+ "num_passages": 326,
4
+ "num_embeddings": 53942,
5
+ "embedding_offset": 0
6
+ }
.ragatouille/colbert/indexes/cbseclass10index/0.residuals.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:935d699b05ca7c7b9ccbe8ac6e8f4d9506892a3765d7cccf90f9ea9654ba6a41
3
+ size 6905776
.ragatouille/colbert/indexes/cbseclass10index/avg_residual.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00e8b363ffb5ba356ee37f82f7f1020d31a3981d94918c7014bb765587aad9f8
3
+ size 1205
.ragatouille/colbert/indexes/cbseclass10index/buckets.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3917cea19a74b8606f4e6d265156fd62d61f2862fdde0d3023f2a4797a3108ea
3
+ size 2904
.ragatouille/colbert/indexes/cbseclass10index/centroids.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34b0e247a9ec74dc5158d1c1846c0a81c793c6a778a66b0bf849cfff3568816e
3
+ size 525478
.ragatouille/colbert/indexes/cbseclass10index/collection.json ADDED
The diff for this file is too large to render. See raw diff
 
.ragatouille/colbert/indexes/cbseclass10index/doclens.0.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [148,205,62,181,199,84,112,133,187,87,163,132,170,105,156,204,193,99,125,166,144,82,176,195,185,172,173,166,148,47,179,149,183,161,123,123,100,167,189,190,185,137,150,173,157,138,69,166,161,96,127,161,156,164,114,181,151,134,57,185,168,84,195,180,210,140,188,197,96,173,195,88,196,187,65,183,176,134,183,199,111,169,186,183,195,188,171,194,209,176,164,176,110,169,170,163,149,143,214,236,200,216,215,230,233,110,232,236,151,239,123,224,167,165,238,161,185,238,188,220,139,142,117,200,170,210,140,222,204,230,167,210,182,156,170,242,189,184,46,211,166,130,197,221,211,126,112,151,90,238,164,231,84,231,230,187,168,205,184,112,142,216,184,127,145,226,178,188,186,118,184,223,189,190,202,167,194,102,185,161,192,166,188,147,198,127,192,128,188,138,183,163,179,125,178,136,156,179,199,192,50,182,175,88,207,165,74,160,196,65,198,122,149,165,192,124,183,165,177,203,104,162,195,93,212,181,205,197,191,158,173,200,62,133,210,212,201,197,186,215,100,120,174,195,75,209,205,186,174,98,190,200,191,184,88,217,190,205,206,96,187,207,83,196,212,184,204,97,188,225,110,201,213,84,212,186,85,189,193,101,105,158,161,87,172,169,81,173,183,104,124,197,190,58,152,188,104,192,178,79,180,116,198,136,195,185,181,214,68,215,190,184,162,124,148,132,210,140,162,217,211,222,181,223,213,154]
.ragatouille/colbert/indexes/cbseclass10index/ivf.pid.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4906fbdd48f229c783b3ab16f9e9bf86ac525bab469dcc58962efd28280ab73a
3
+ size 103640
.ragatouille/colbert/indexes/cbseclass10index/metadata.json ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "config":{
3
+ "query_token_id":"[unused0]",
4
+ "doc_token_id":"[unused1]",
5
+ "query_token":"[Q]",
6
+ "doc_token":"[D]",
7
+ "ncells":null,
8
+ "centroid_score_threshold":null,
9
+ "ndocs":null,
10
+ "load_index_with_mmap":false,
11
+ "index_path":null,
12
+ "index_bsize":32,
13
+ "nbits":8,
14
+ "kmeans_niters":20,
15
+ "resume":false,
16
+ "similarity":"cosine",
17
+ "bsize":64,
18
+ "accumsteps":1,
19
+ "lr":0.00001,
20
+ "maxsteps":400000,
21
+ "save_every":null,
22
+ "warmup":20000,
23
+ "warmup_bert":null,
24
+ "relu":false,
25
+ "nway":64,
26
+ "use_ib_negatives":true,
27
+ "reranker":false,
28
+ "distillation_alpha":1.0,
29
+ "ignore_scores":false,
30
+ "model_name":null,
31
+ "query_maxlen":32,
32
+ "attend_to_mask_tokens":false,
33
+ "interaction":"colbert",
34
+ "dim":128,
35
+ "doc_maxlen":256,
36
+ "mask_punctuation":true,
37
+ "checkpoint":"colbert-ir/colbertv2.0",
38
+ "triples":"/future/u/okhattab/root/unit/experiments/2021.10/downstream.distillation.round2.2_score/round2.nway6.cosine.ib/examples.64.json",
39
+ "collection":[
40
+ "list with 326 elements starting with...",
41
+ [
42
+ "chemistry-notes-CBSE class-10-chapter-1.txt\nChemical Reactions and Equations\nIntroduction to Chemical Reactions and Equations\nPhysical and chemical changes\nChemical change - one or more new substances with new physical and chemical properties\nare formed.\nExample: Fe(s)\u00a0 + \u00a0CuSO 4(aq) \u2192FeSO 4(aq) +Cu(s)\u00a0\n \u00a0 \u00a0 \u00a0 (Blue)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (Green)\u00a0 \u00a0 \u00a0 \u00a0\nHere, when copper sulphate reacts with iron, two new substances, i.e., ferrous sulphate and\ncopper are formed.\nPhysical change - change in colour or state occurs but no new substance is formed.\nExample: Water changes to steam on boiling but no new substance is formed(Even though\nsteam and water look different when they are made to react with a piece of Na, they react\nthe same way and give the exact same products). This involves only change in state (liquid\nto vapour).",
43
+ "Example: Water changes to steam on boiling but no new substance is formed(Even though\nsteam and water look different when they are made to react with a piece of Na, they react\nthe same way and give the exact same products). This involves only change in state (liquid\nto vapour).\u00a0\nObservations that help determine a chemical reaction\nA chemical reaction can be determined with the help of any of the following observations:\na) Evolution of a gas\nb) Change in temperature\nc) Formation of a precipitate\nd) Change in colour\ne) Change of state\nChemical reaction\nChemical reactions are chemical changes in which reactants transform into products by\nmaking or breaking of bonds(or both) between different atoms.\nTypes of chemical reactionsTaking into consideration different factors, chemical reactions are grouped into multiple\ncategories.\nFew examples are:\n\u25cfCombination\n\u25cfDecomposition\n\u25cfSingle Displacement\n\u25cfDouble displacement\n\u25cfRedox\n\u25cfEndothermic\n\u25cfExothermic\n\u25cfPrecipitation\n\u25cfNeutralisation\nChemical Reactions and Equations I\nWord equation\nA\u00a0 word equation is a\u00a0chemical reaction\u00a0expressed in words rather than\u00a0chemical\nformulas.",
44
+ "It helps identify the reactants and products in a chemical reaction.\nFor example,\u00a0\nSodium + Chlorine \u2192 Sodium chloride\nThe above equation means: \"Sodium reacts with chlorine to form sodium chloride.\"\u00a0\nSymbols of elements and their valencies\nA symbol is the chemical code for an element. Each element has one or two letter atomic"
45
+ ]
46
+ ],
47
+ "queries":"/future/u/okhattab/data/MSMARCO/queries.train.tsv",
48
+ "index_name":"cbseclass10index",
49
+ "overwrite":false,
50
+ "root":".ragatouille/",
51
+ "experiment":"colbert",
52
+ "index_root":null,
53
+ "name":"2024-04/18/18.31.20",
54
+ "rank":0,
55
+ "nranks":1,
56
+ "amp":true,
57
+ "gpus":1,
58
+ "avoid_fork_if_possible":false
59
+ },
60
+ "num_chunks":1,
61
+ "num_partitions":2048,
62
+ "num_embeddings":53942,
63
+ "avg_doclen":165.4662576687,
64
+ "RAGatouille":{
65
+ "index_config":{
66
+ "index_type":"PLAID",
67
+ "index_name":"cbseclass10index"
68
+ }
69
+ }
70
+ }
.ragatouille/colbert/indexes/cbseclass10index/pid_docid_map.json ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "0":"b50e7afa-47cd-4451-ac58-646854aa9c85",
3
+ "1":"b50e7afa-47cd-4451-ac58-646854aa9c85",
4
+ "2":"b50e7afa-47cd-4451-ac58-646854aa9c85",
5
+ "3":"ac0b1a5a-ace7-4004-9565-1ab12ecf2167",
6
+ "4":"ac0b1a5a-ace7-4004-9565-1ab12ecf2167",
7
+ "5":"ac0b1a5a-ace7-4004-9565-1ab12ecf2167",
8
+ "6":"9b1d27f5-c44e-4d18-911d-4c82f7b534c9",
9
+ "7":"9b1d27f5-c44e-4d18-911d-4c82f7b534c9",
10
+ "8":"9b1d27f5-c44e-4d18-911d-4c82f7b534c9",
11
+ "9":"9b1d27f5-c44e-4d18-911d-4c82f7b534c9",
12
+ "10":"c49d5dfd-2fcb-4373-bea2-cf854bbf4ca2",
13
+ "11":"c49d5dfd-2fcb-4373-bea2-cf854bbf4ca2",
14
+ "12":"c49d5dfd-2fcb-4373-bea2-cf854bbf4ca2",
15
+ "13":"98d3ced6-a27e-4369-8f9f-22f71a6aa9a7",
16
+ "14":"98d3ced6-a27e-4369-8f9f-22f71a6aa9a7",
17
+ "15":"3963edbc-14ba-42bb-8771-8733e5b932be",
18
+ "16":"3963edbc-14ba-42bb-8771-8733e5b932be",
19
+ "17":"3963edbc-14ba-42bb-8771-8733e5b932be",
20
+ "18":"a238fc02-34aa-4c33-9f9b-5c917602e4bc",
21
+ "19":"a238fc02-34aa-4c33-9f9b-5c917602e4bc",
22
+ "20":"a238fc02-34aa-4c33-9f9b-5c917602e4bc",
23
+ "21":"a238fc02-34aa-4c33-9f9b-5c917602e4bc",
24
+ "22":"568ac174-ecf7-4ab9-af49-68778e7680f3",
25
+ "23":"568ac174-ecf7-4ab9-af49-68778e7680f3",
26
+ "24":"568ac174-ecf7-4ab9-af49-68778e7680f3",
27
+ "25":"bc6bf421-89ae-4acd-85f7-9d7835a4e9cb",
28
+ "26":"bc6bf421-89ae-4acd-85f7-9d7835a4e9cb",
29
+ "27":"bc6bf421-89ae-4acd-85f7-9d7835a4e9cb",
30
+ "28":"bc6bf421-89ae-4acd-85f7-9d7835a4e9cb",
31
+ "29":"81daa51d-63b8-4261-a68b-547be1872b77",
32
+ "30":"81daa51d-63b8-4261-a68b-547be1872b77",
33
+ "31":"81daa51d-63b8-4261-a68b-547be1872b77",
34
+ "32":"81daa51d-63b8-4261-a68b-547be1872b77",
35
+ "33":"ec6aaa1a-1913-427d-be8d-191344e5a3a0",
36
+ "34":"ec6aaa1a-1913-427d-be8d-191344e5a3a0",
37
+ "35":"ec6aaa1a-1913-427d-be8d-191344e5a3a0",
38
+ "36":"24ec6256-a24a-458a-b2de-78043453b2a5",
39
+ "37":"24ec6256-a24a-458a-b2de-78043453b2a5",
40
+ "38":"24ec6256-a24a-458a-b2de-78043453b2a5",
41
+ "39":"5d23a859-6ae7-47a8-b19f-b19c0389cfac",
42
+ "40":"5d23a859-6ae7-47a8-b19f-b19c0389cfac",
43
+ "41":"5d23a859-6ae7-47a8-b19f-b19c0389cfac",
44
+ "42":"2420c4a0-36a1-4aec-8d9b-58fb65ecff86",
45
+ "43":"2420c4a0-36a1-4aec-8d9b-58fb65ecff86",
46
+ "44":"2420c4a0-36a1-4aec-8d9b-58fb65ecff86",
47
+ "45":"2420c4a0-36a1-4aec-8d9b-58fb65ecff86",
48
+ "46":"2420c4a0-36a1-4aec-8d9b-58fb65ecff86",
49
+ "47":"6719bbf2-854a-43af-89fb-401137a9fd5c",
50
+ "48":"6719bbf2-854a-43af-89fb-401137a9fd5c",
51
+ "49":"6719bbf2-854a-43af-89fb-401137a9fd5c",
52
+ "50":"6719bbf2-854a-43af-89fb-401137a9fd5c",
53
+ "51":"e219add5-6352-429b-9ef5-0f0bc36b47b6",
54
+ "52":"e219add5-6352-429b-9ef5-0f0bc36b47b6",
55
+ "53":"e219add5-6352-429b-9ef5-0f0bc36b47b6",
56
+ "54":"e219add5-6352-429b-9ef5-0f0bc36b47b6",
57
+ "55":"ec616103-a958-4710-a8b3-3416c689c5a1",
58
+ "56":"ec616103-a958-4710-a8b3-3416c689c5a1",
59
+ "57":"ec616103-a958-4710-a8b3-3416c689c5a1",
60
+ "58":"ec616103-a958-4710-a8b3-3416c689c5a1",
61
+ "59":"8748d787-e151-4153-a87d-63d348eb3090",
62
+ "60":"8748d787-e151-4153-a87d-63d348eb3090",
63
+ "61":"8748d787-e151-4153-a87d-63d348eb3090",
64
+ "62":"1ebf1e10-dce6-4d02-9690-b58c3f4ad3aa",
65
+ "63":"371135ec-5fd8-4d07-beff-b753c5fc1939",
66
+ "64":"371135ec-5fd8-4d07-beff-b753c5fc1939",
67
+ "65":"371135ec-5fd8-4d07-beff-b753c5fc1939",
68
+ "66":"08c48bfd-62f2-4439-8aa0-73c01e3ce7b2",
69
+ "67":"08c48bfd-62f2-4439-8aa0-73c01e3ce7b2",
70
+ "68":"08c48bfd-62f2-4439-8aa0-73c01e3ce7b2",
71
+ "69":"9c9ccebf-95a9-45d8-9018-ca5d79cc2cd2",
72
+ "70":"9c9ccebf-95a9-45d8-9018-ca5d79cc2cd2",
73
+ "71":"9c9ccebf-95a9-45d8-9018-ca5d79cc2cd2",
74
+ "72":"a4ae06e3-28da-4a18-a228-b6c03da8d71c",
75
+ "73":"a4ae06e3-28da-4a18-a228-b6c03da8d71c",
76
+ "74":"a4ae06e3-28da-4a18-a228-b6c03da8d71c",
77
+ "75":"245ded36-8dd5-43d6-8863-d2d62a491118",
78
+ "76":"245ded36-8dd5-43d6-8863-d2d62a491118",
79
+ "77":"245ded36-8dd5-43d6-8863-d2d62a491118",
80
+ "78":"cc1f9e2f-7dc8-43a7-aeed-c2ce40b93a9a",
81
+ "79":"cc1f9e2f-7dc8-43a7-aeed-c2ce40b93a9a",
82
+ "80":"cc1f9e2f-7dc8-43a7-aeed-c2ce40b93a9a",
83
+ "81":"647f222d-bb69-45ee-9105-25d4946b5d10",
84
+ "82":"647f222d-bb69-45ee-9105-25d4946b5d10",
85
+ "83":"647f222d-bb69-45ee-9105-25d4946b5d10",
86
+ "84":"3d0f92c9-b405-4fa6-8d65-a76436a31de2",
87
+ "85":"3d0f92c9-b405-4fa6-8d65-a76436a31de2",
88
+ "86":"3d0f92c9-b405-4fa6-8d65-a76436a31de2",
89
+ "87":"23436601-6cfe-4914-b4d2-5875accca435",
90
+ "88":"23436601-6cfe-4914-b4d2-5875accca435",
91
+ "89":"23436601-6cfe-4914-b4d2-5875accca435",
92
+ "90":"2af80fc7-4495-4474-a747-c681aab080a0",
93
+ "91":"2af80fc7-4495-4474-a747-c681aab080a0",
94
+ "92":"2af80fc7-4495-4474-a747-c681aab080a0",
95
+ "93":"9eb79d19-5f90-4af5-8d6e-e7301763e143",
96
+ "94":"9eb79d19-5f90-4af5-8d6e-e7301763e143",
97
+ "95":"63d607d2-1d35-45f5-b9b0-e88c345f2d1c",
98
+ "96":"63d607d2-1d35-45f5-b9b0-e88c345f2d1c",
99
+ "97":"63d607d2-1d35-45f5-b9b0-e88c345f2d1c",
100
+ "98":"56a18958-bc4b-4ba1-891c-07a3f2416b2c",
101
+ "99":"56a18958-bc4b-4ba1-891c-07a3f2416b2c",
102
+ "100":"df5712de-05f9-4dbf-b27a-eb6a92b3a894",
103
+ "101":"e29b5868-73c9-42eb-af69-1f2ac264e041",
104
+ "102":"e29b5868-73c9-42eb-af69-1f2ac264e041",
105
+ "103":"54ebfa61-f7cf-4b4b-985f-8b7a668bd502",
106
+ "104":"54ebfa61-f7cf-4b4b-985f-8b7a668bd502",
107
+ "105":"54ebfa61-f7cf-4b4b-985f-8b7a668bd502",
108
+ "106":"80509856-fd88-4c48-a4b9-8611da1d9452",
109
+ "107":"80509856-fd88-4c48-a4b9-8611da1d9452",
110
+ "108":"e3959900-17db-47f1-9b6c-bd36ac53b7e8",
111
+ "109":"e3959900-17db-47f1-9b6c-bd36ac53b7e8",
112
+ "110":"e3959900-17db-47f1-9b6c-bd36ac53b7e8",
113
+ "111":"ae3a76b3-8c2b-4e97-87e5-1a2cf3b6dc06",
114
+ "112":"ae3a76b3-8c2b-4e97-87e5-1a2cf3b6dc06",
115
+ "113":"44335474-14e1-4338-8cd4-a4047de9dcc7",
116
+ "114":"2692ade3-17e9-44fd-8dd8-48dd39e27866",
117
+ "115":"2692ade3-17e9-44fd-8dd8-48dd39e27866",
118
+ "116":"9e18c20b-a860-4ec8-ba0b-21c34cd0e27f",
119
+ "117":"757940b1-b5f4-4302-affb-38f02a96eec7",
120
+ "118":"757940b1-b5f4-4302-affb-38f02a96eec7",
121
+ "119":"09c460a2-69cc-427a-b3d9-7cca5efdb1d8",
122
+ "120":"09c460a2-69cc-427a-b3d9-7cca5efdb1d8",
123
+ "121":"feaf5700-fd3e-46eb-994c-d0c05b6d110d",
124
+ "122":"feaf5700-fd3e-46eb-994c-d0c05b6d110d",
125
+ "123":"a36e12fb-e02b-4d3d-9aca-ece2d17465da",
126
+ "124":"a36e12fb-e02b-4d3d-9aca-ece2d17465da",
127
+ "125":"382a156c-47af-4e02-80fb-10e1aabf6358",
128
+ "126":"382a156c-47af-4e02-80fb-10e1aabf6358",
129
+ "127":"fdf385e7-ddba-4606-b05a-1af903963d53",
130
+ "128":"fdf385e7-ddba-4606-b05a-1af903963d53",
131
+ "129":"f343109d-2e42-491c-8400-ed8bfe641878",
132
+ "130":"f343109d-2e42-491c-8400-ed8bfe641878",
133
+ "131":"ef0ce98f-28ba-406d-9dd7-abcd4799c25c",
134
+ "132":"ef0ce98f-28ba-406d-9dd7-abcd4799c25c",
135
+ "133":"c25e3272-ce5f-4da2-998d-b744b664d370",
136
+ "134":"beab4bca-c73a-4de5-98bc-0630c3636f90",
137
+ "135":"beab4bca-c73a-4de5-98bc-0630c3636f90",
138
+ "136":"543ce86e-2f6f-4fd3-ad48-8763494a17df",
139
+ "137":"543ce86e-2f6f-4fd3-ad48-8763494a17df",
140
+ "138":"543ce86e-2f6f-4fd3-ad48-8763494a17df",
141
+ "139":"4d94be87-267e-431b-884b-6f3eb5e8b4d8",
142
+ "140":"4d94be87-267e-431b-884b-6f3eb5e8b4d8",
143
+ "141":"5644b3b6-c93d-4f33-8d37-c7e9485a01db",
144
+ "142":"7a89bc9b-8bee-42bd-93b8-ba7725401d24",
145
+ "143":"7a89bc9b-8bee-42bd-93b8-ba7725401d24",
146
+ "144":"a7ac227b-0588-4799-b223-ca589f6c5b2d",
147
+ "145":"a7ac227b-0588-4799-b223-ca589f6c5b2d",
148
+ "146":"a7ac227b-0588-4799-b223-ca589f6c5b2d",
149
+ "147":"bee00e32-6ec9-4cb0-9b67-cedfd389521b",
150
+ "148":"bee00e32-6ec9-4cb0-9b67-cedfd389521b",
151
+ "149":"bee00e32-6ec9-4cb0-9b67-cedfd389521b",
152
+ "150":"824bb39d-53ae-4845-8d6a-2cdffb204fd6",
153
+ "151":"824bb39d-53ae-4845-8d6a-2cdffb204fd6",
154
+ "152":"824bb39d-53ae-4845-8d6a-2cdffb204fd6",
155
+ "153":"81ed39b2-7cb1-4884-aa6b-e8461a226d47",
156
+ "154":"81ed39b2-7cb1-4884-aa6b-e8461a226d47",
157
+ "155":"f5f5558b-df2a-4cbb-9c66-1e8e36e02cff",
158
+ "156":"f5f5558b-df2a-4cbb-9c66-1e8e36e02cff",
159
+ "157":"b59ffde7-0d4b-4ed3-8adf-073fb6a576bf",
160
+ "158":"b59ffde7-0d4b-4ed3-8adf-073fb6a576bf",
161
+ "159":"8b75ee9e-45c3-46ae-8f3b-79c53596bb0f",
162
+ "160":"6fb10798-7766-4165-bf33-0dc0df6305f4",
163
+ "161":"6fb10798-7766-4165-bf33-0dc0df6305f4",
164
+ "162":"bcb7ea2b-a967-4d54-ba47-283ce63b9bda",
165
+ "163":"bcb7ea2b-a967-4d54-ba47-283ce63b9bda",
166
+ "164":"bcb7ea2b-a967-4d54-ba47-283ce63b9bda",
167
+ "165":"7a8ff9aa-500a-4093-9077-087a303717ce",
168
+ "166":"7a8ff9aa-500a-4093-9077-087a303717ce",
169
+ "167":"1b917d3f-1395-47e0-b2b7-3ef1ef850821",
170
+ "168":"1b917d3f-1395-47e0-b2b7-3ef1ef850821",
171
+ "169":"675552bd-c7c9-42a0-8d36-e84f021d386a",
172
+ "170":"675552bd-c7c9-42a0-8d36-e84f021d386a",
173
+ "171":"aa6b5279-66a5-455d-bf7d-92d9393aaaac",
174
+ "172":"aa6b5279-66a5-455d-bf7d-92d9393aaaac",
175
+ "173":"1651cdd4-2e84-4e0d-84ad-c6d521510fb2",
176
+ "174":"1651cdd4-2e84-4e0d-84ad-c6d521510fb2",
177
+ "175":"eea1fc17-f156-47cf-9347-312b2e3f3056",
178
+ "176":"220d5961-fbdc-42b6-a6ca-8794010d7cae",
179
+ "177":"220d5961-fbdc-42b6-a6ca-8794010d7cae",
180
+ "178":"7cf11bc3-81a6-41ba-8f4d-aa74c9857d2b",
181
+ "179":"7cf11bc3-81a6-41ba-8f4d-aa74c9857d2b",
182
+ "180":"83421ab7-c0d5-4453-a346-3d9dd13b337a",
183
+ "181":"83421ab7-c0d5-4453-a346-3d9dd13b337a",
184
+ "182":"14fb9126-6776-4816-84c1-98b9a0b12b4f",
185
+ "183":"14fb9126-6776-4816-84c1-98b9a0b12b4f",
186
+ "184":"9fcf645f-695c-4f06-be5a-aeae3228cb1e",
187
+ "185":"9fcf645f-695c-4f06-be5a-aeae3228cb1e",
188
+ "186":"5845b39f-f936-4a3e-96f7-d8137d69d3a1",
189
+ "187":"5845b39f-f936-4a3e-96f7-d8137d69d3a1",
190
+ "188":"490008ee-2c8c-455c-86d2-2cf634a595b1",
191
+ "189":"490008ee-2c8c-455c-86d2-2cf634a595b1",
192
+ "190":"86eecd6e-11d7-4995-be20-6bbc0ebd3914",
193
+ "191":"86eecd6e-11d7-4995-be20-6bbc0ebd3914",
194
+ "192":"9ce65475-0f42-4fbf-9849-25b571af95b7",
195
+ "193":"9ce65475-0f42-4fbf-9849-25b571af95b7",
196
+ "194":"c8467e25-a012-4957-b41c-22d605695ee4",
197
+ "195":"c8467e25-a012-4957-b41c-22d605695ee4",
198
+ "196":"2ef1de6b-0d09-46ac-8a19-f4ab036ffa7c",
199
+ "197":"2ef1de6b-0d09-46ac-8a19-f4ab036ffa7c",
200
+ "198":"e714460c-acda-47aa-8216-c3e6a51f54a9",
201
+ "199":"e714460c-acda-47aa-8216-c3e6a51f54a9",
202
+ "200":"e714460c-acda-47aa-8216-c3e6a51f54a9",
203
+ "201":"11b33777-8ecf-4da1-8268-1ed3cd366006",
204
+ "202":"11b33777-8ecf-4da1-8268-1ed3cd366006",
205
+ "203":"11b33777-8ecf-4da1-8268-1ed3cd366006",
206
+ "204":"65d3b9c4-c1c5-4501-babd-f5ea5b36b771",
207
+ "205":"65d3b9c4-c1c5-4501-babd-f5ea5b36b771",
208
+ "206":"65d3b9c4-c1c5-4501-babd-f5ea5b36b771",
209
+ "207":"eced088e-b0d4-4bbf-8932-05f193f847ea",
210
+ "208":"eced088e-b0d4-4bbf-8932-05f193f847ea",
211
+ "209":"eced088e-b0d4-4bbf-8932-05f193f847ea",
212
+ "210":"574d970f-1a3e-46b1-b0d3-8d0d530feff0",
213
+ "211":"574d970f-1a3e-46b1-b0d3-8d0d530feff0",
214
+ "212":"69eb0531-f3a1-40b8-84e8-1d4205262899",
215
+ "213":"69eb0531-f3a1-40b8-84e8-1d4205262899",
216
+ "214":"970fdbb6-06c4-4a19-a65e-ef90bc48905b",
217
+ "215":"970fdbb6-06c4-4a19-a65e-ef90bc48905b",
218
+ "216":"2c62ce1c-68c7-4651-8d38-3b933dc75855",
219
+ "217":"2c62ce1c-68c7-4651-8d38-3b933dc75855",
220
+ "218":"43f94261-62a6-47ba-9f02-cf788ed73270",
221
+ "219":"43f94261-62a6-47ba-9f02-cf788ed73270",
222
+ "220":"43f94261-62a6-47ba-9f02-cf788ed73270",
223
+ "221":"8c5d3d99-53ef-4531-8c8e-530838a5a280",
224
+ "222":"8c5d3d99-53ef-4531-8c8e-530838a5a280",
225
+ "223":"8c5d3d99-53ef-4531-8c8e-530838a5a280",
226
+ "224":"6bcdc2e1-f25c-4448-bf04-8c8bc7eed0d6",
227
+ "225":"6bcdc2e1-f25c-4448-bf04-8c8bc7eed0d6",
228
+ "226":"694f72c2-1116-4e6b-8372-98690499fd47",
229
+ "227":"694f72c2-1116-4e6b-8372-98690499fd47",
230
+ "228":"3b533216-1e2b-4f4d-8c14-181ad49aff81",
231
+ "229":"3b533216-1e2b-4f4d-8c14-181ad49aff81",
232
+ "230":"f5f8e8a6-13de-4c34-a3cc-05ccd859dcb7",
233
+ "231":"f5f8e8a6-13de-4c34-a3cc-05ccd859dcb7",
234
+ "232":"f5f8e8a6-13de-4c34-a3cc-05ccd859dcb7",
235
+ "233":"f923ad16-4ff4-41b8-b316-302221a7acb0",
236
+ "234":"530ef8c2-ea04-4df7-988f-f70185be0ad3",
237
+ "235":"530ef8c2-ea04-4df7-988f-f70185be0ad3",
238
+ "236":"a89e8e7b-fab1-4f79-89bc-69c67cc02c07",
239
+ "237":"a89e8e7b-fab1-4f79-89bc-69c67cc02c07",
240
+ "238":"6d4e3138-5f26-4b52-a60e-3aea6d30c4f5",
241
+ "239":"6d4e3138-5f26-4b52-a60e-3aea6d30c4f5",
242
+ "240":"6d4e3138-5f26-4b52-a60e-3aea6d30c4f5",
243
+ "241":"d3f34358-b4ac-4b3f-97de-2fb68b047628",
244
+ "242":"21f9f203-6ca0-441f-bcd4-1dac57e10609",
245
+ "243":"21f9f203-6ca0-441f-bcd4-1dac57e10609",
246
+ "244":"21f9f203-6ca0-441f-bcd4-1dac57e10609",
247
+ "245":"95554e83-5f8f-44b8-baec-0692083797e6",
248
+ "246":"95554e83-5f8f-44b8-baec-0692083797e6",
249
+ "247":"a50ba0dd-0c6e-402c-9daf-ec31cad79620",
250
+ "248":"a50ba0dd-0c6e-402c-9daf-ec31cad79620",
251
+ "249":"a50ba0dd-0c6e-402c-9daf-ec31cad79620",
252
+ "250":"cb384c5a-03c9-4ffb-932d-c0f7dd9aa646",
253
+ "251":"cb384c5a-03c9-4ffb-932d-c0f7dd9aa646",
254
+ "252":"10f2505a-be8b-4e6f-a734-a05a96ef1418",
255
+ "253":"10f2505a-be8b-4e6f-a734-a05a96ef1418",
256
+ "254":"10f2505a-be8b-4e6f-a734-a05a96ef1418",
257
+ "255":"dc7f5858-1d12-44b0-9eb8-3b612f6242e6",
258
+ "256":"dc7f5858-1d12-44b0-9eb8-3b612f6242e6",
259
+ "257":"a47d4614-12d8-42ab-a588-6c73adf1457f",
260
+ "258":"a47d4614-12d8-42ab-a588-6c73adf1457f",
261
+ "259":"a47d4614-12d8-42ab-a588-6c73adf1457f",
262
+ "260":"1f97d616-8352-47e8-b55e-8baf2e5b88e5",
263
+ "261":"1f97d616-8352-47e8-b55e-8baf2e5b88e5",
264
+ "262":"1f97d616-8352-47e8-b55e-8baf2e5b88e5",
265
+ "263":"4a573720-6dea-4c0f-9a74-74fffe0f53b9",
266
+ "264":"4a573720-6dea-4c0f-9a74-74fffe0f53b9",
267
+ "265":"23f9e01e-a034-47d2-9e86-c1755ba88558",
268
+ "266":"23f9e01e-a034-47d2-9e86-c1755ba88558",
269
+ "267":"23f9e01e-a034-47d2-9e86-c1755ba88558",
270
+ "268":"45ad6fb2-7c77-468f-aeea-f133e29b3d26",
271
+ "269":"45ad6fb2-7c77-468f-aeea-f133e29b3d26",
272
+ "270":"45ad6fb2-7c77-468f-aeea-f133e29b3d26",
273
+ "271":"3d333d4b-6617-409e-88ac-6555d573d1ae",
274
+ "272":"3d333d4b-6617-409e-88ac-6555d573d1ae",
275
+ "273":"3d333d4b-6617-409e-88ac-6555d573d1ae",
276
+ "274":"ea2a76b4-a871-4f15-a0ac-b1fd98588d22",
277
+ "275":"ea2a76b4-a871-4f15-a0ac-b1fd98588d22",
278
+ "276":"ea2a76b4-a871-4f15-a0ac-b1fd98588d22",
279
+ "277":"0e6c8467-675d-4cc4-a823-bf7fa62c6f12",
280
+ "278":"0e6c8467-675d-4cc4-a823-bf7fa62c6f12",
281
+ "279":"0e6c8467-675d-4cc4-a823-bf7fa62c6f12",
282
+ "280":"e7634535-fe2d-4c3d-b603-07f8a682cc8c",
283
+ "281":"1be97819-d046-40bc-86a4-b13817984c6b",
284
+ "282":"1be97819-d046-40bc-86a4-b13817984c6b",
285
+ "283":"1be97819-d046-40bc-86a4-b13817984c6b",
286
+ "284":"0e2bb8b3-dbef-4117-bbcf-aeec79fc0664",
287
+ "285":"0e2bb8b3-dbef-4117-bbcf-aeec79fc0664",
288
+ "286":"0e2bb8b3-dbef-4117-bbcf-aeec79fc0664",
289
+ "287":"668e7c14-b0ad-423c-bbba-3a82f76feb73",
290
+ "288":"668e7c14-b0ad-423c-bbba-3a82f76feb73",
291
+ "289":"668e7c14-b0ad-423c-bbba-3a82f76feb73",
292
+ "290":"943c7163-a642-476a-b2d3-e40a6584bab9",
293
+ "291":"390f92d8-d275-4e0b-9672-7ac2bc8687a0",
294
+ "292":"390f92d8-d275-4e0b-9672-7ac2bc8687a0",
295
+ "293":"390f92d8-d275-4e0b-9672-7ac2bc8687a0",
296
+ "294":"c1de8abd-38c0-43a1-8c87-ba71863881d1",
297
+ "295":"c1de8abd-38c0-43a1-8c87-ba71863881d1",
298
+ "296":"c1de8abd-38c0-43a1-8c87-ba71863881d1",
299
+ "297":"1fb0793b-0683-49d9-bc5b-80f9b64ae4c1",
300
+ "298":"1fb0793b-0683-49d9-bc5b-80f9b64ae4c1",
301
+ "299":"1fb0793b-0683-49d9-bc5b-80f9b64ae4c1",
302
+ "300":"c298ae79-b369-4b6b-aba5-26eb0b1e4d27",
303
+ "301":"c298ae79-b369-4b6b-aba5-26eb0b1e4d27",
304
+ "302":"12f95ac5-e726-42b0-a7f1-2765b3b315b9",
305
+ "303":"12f95ac5-e726-42b0-a7f1-2765b3b315b9",
306
+ "304":"cfd87320-2a78-4217-b767-fbfa48b2e0e4",
307
+ "305":"cfd87320-2a78-4217-b767-fbfa48b2e0e4",
308
+ "306":"545a55ef-266e-444e-ad30-b549501a1e57",
309
+ "307":"545a55ef-266e-444e-ad30-b549501a1e57",
310
+ "308":"545a55ef-266e-444e-ad30-b549501a1e57",
311
+ "309":"dd35aa0f-a84e-43a4-b51a-04b5434e7058",
312
+ "310":"dd35aa0f-a84e-43a4-b51a-04b5434e7058",
313
+ "311":"406f2624-acd2-4fbf-befb-431b1f49ce1d",
314
+ "312":"9e9aa0b3-18b9-418d-8018-8ccc58884ccd",
315
+ "313":"9e9aa0b3-18b9-418d-8018-8ccc58884ccd",
316
+ "314":"0ecd7bcd-24d8-4568-bdf4-0345c79e9ff9",
317
+ "315":"0ecd7bcd-24d8-4568-bdf4-0345c79e9ff9",
318
+ "316":"9024069b-ab19-44f9-89fa-1c1279eca9de",
319
+ "317":"9024069b-ab19-44f9-89fa-1c1279eca9de",
320
+ "318":"9024069b-ab19-44f9-89fa-1c1279eca9de",
321
+ "319":"1cf64dd2-13e3-4215-a3f4-3c6e68bbbc1a",
322
+ "320":"1cf64dd2-13e3-4215-a3f4-3c6e68bbbc1a",
323
+ "321":"6a583fa3-ac37-41e6-80c0-931a9b6f9212",
324
+ "322":"6a583fa3-ac37-41e6-80c0-931a9b6f9212",
325
+ "323":"63b06175-6253-4720-9245-cc520137f079",
326
+ "324":"63b06175-6253-4720-9245-cc520137f079",
327
+ "325":"2fd23385-caa3-4308-99d3-ac69b9af4c5a"
328
+ }
.ragatouille/colbert/indexes/cbseclass10index/plan.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "config": {
3
+ "query_token_id": "[unused0]",
4
+ "doc_token_id": "[unused1]",
5
+ "query_token": "[Q]",
6
+ "doc_token": "[D]",
7
+ "ncells": null,
8
+ "centroid_score_threshold": null,
9
+ "ndocs": null,
10
+ "load_index_with_mmap": false,
11
+ "index_path": null,
12
+ "index_bsize": 32,
13
+ "nbits": 8,
14
+ "kmeans_niters": 20,
15
+ "resume": false,
16
+ "similarity": "cosine",
17
+ "bsize": 64,
18
+ "accumsteps": 1,
19
+ "lr": 1e-5,
20
+ "maxsteps": 400000,
21
+ "save_every": null,
22
+ "warmup": 20000,
23
+ "warmup_bert": null,
24
+ "relu": false,
25
+ "nway": 64,
26
+ "use_ib_negatives": true,
27
+ "reranker": false,
28
+ "distillation_alpha": 1.0,
29
+ "ignore_scores": false,
30
+ "model_name": null,
31
+ "query_maxlen": 32,
32
+ "attend_to_mask_tokens": false,
33
+ "interaction": "colbert",
34
+ "dim": 128,
35
+ "doc_maxlen": 256,
36
+ "mask_punctuation": true,
37
+ "checkpoint": "colbert-ir\/colbertv2.0",
38
+ "triples": "\/future\/u\/okhattab\/root\/unit\/experiments\/2021.10\/downstream.distillation.round2.2_score\/round2.nway6.cosine.ib\/examples.64.json",
39
+ "collection": [
40
+ "list with 326 elements starting with...",
41
+ [
42
+ "chemistry-notes-CBSE class-10-chapter-1.txt\nChemical Reactions and Equations\nIntroduction to Chemical Reactions and Equations\nPhysical and chemical changes\nChemical change - one or more new substances with new physical and chemical properties\nare formed.\nExample: Fe(s)\u00a0 + \u00a0CuSO 4(aq) \u2192FeSO 4(aq) +Cu(s)\u00a0\n \u00a0 \u00a0 \u00a0 (Blue)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (Green)\u00a0 \u00a0 \u00a0 \u00a0\nHere, when copper sulphate reacts with iron, two new substances, i.e., ferrous sulphate and\ncopper are formed.\nPhysical change - change in colour or state occurs but no new substance is formed.\nExample: Water changes to steam on boiling but no new substance is formed(Even though\nsteam and water look different when they are made to react with a piece of Na, they react\nthe same way and give the exact same products). This involves only change in state (liquid\nto vapour).",
43
+ "Example: Water changes to steam on boiling but no new substance is formed(Even though\nsteam and water look different when they are made to react with a piece of Na, they react\nthe same way and give the exact same products). This involves only change in state (liquid\nto vapour).\u00a0\nObservations that help determine a chemical reaction\nA chemical reaction can be determined with the help of any of the following observations:\na) Evolution of a gas\nb) Change in temperature\nc) Formation of a precipitate\nd) Change in colour\ne) Change of state\nChemical reaction\nChemical reactions are chemical changes in which reactants transform into products by\nmaking or breaking of bonds(or both) between different atoms.\nTypes of chemical reactionsTaking into consideration different factors, chemical reactions are grouped into multiple\ncategories.\nFew examples are:\n\u25cfCombination\n\u25cfDecomposition\n\u25cfSingle Displacement\n\u25cfDouble displacement\n\u25cfRedox\n\u25cfEndothermic\n\u25cfExothermic\n\u25cfPrecipitation\n\u25cfNeutralisation\nChemical Reactions and Equations I\nWord equation\nA\u00a0 word equation is a\u00a0chemical reaction\u00a0expressed in words rather than\u00a0chemical\nformulas.",
44
+ "It helps identify the reactants and products in a chemical reaction.\nFor example,\u00a0\nSodium + Chlorine \u2192 Sodium chloride\nThe above equation means: \"Sodium reacts with chlorine to form sodium chloride.\"\u00a0\nSymbols of elements and their valencies\nA symbol is the chemical code for an element. Each element has one or two letter atomic"
45
+ ]
46
+ ],
47
+ "queries": "\/future\/u\/okhattab\/data\/MSMARCO\/queries.train.tsv",
48
+ "index_name": "cbseclass10index",
49
+ "overwrite": false,
50
+ "root": ".ragatouille\/",
51
+ "experiment": "colbert",
52
+ "index_root": null,
53
+ "name": "2024-04\/18\/18.31.20",
54
+ "rank": 0,
55
+ "nranks": 1,
56
+ "amp": true,
57
+ "gpus": 1,
58
+ "avoid_fork_if_possible": false
59
+ },
60
+ "num_chunks": 1,
61
+ "num_partitions": 2048,
62
+ "num_embeddings_est": 53942.0016784668,
63
+ "avg_doclen_est": 165.4662628173828
64
+ }
README.md CHANGED
@@ -1,12 +1,12 @@
1
  ---
2
- title: CHEERFUL CBSE
3
- emoji: 📊
4
- colorFrom: indigo
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 4.26.0
8
  app_file: app.py
9
  pinned: false
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Expenditure Observer AI Assistant
3
+ emoji: 📚
4
+ colorFrom: red
5
+ colorTo: indigo
6
  sdk: gradio
7
+ sdk_version: 4.7.1
8
  app_file: app.py
9
  pinned: false
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app (1).py ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from ragatouille import RAGPretrainedModel
3
+ import subprocess
4
+ import json
5
+ import firebase_admin
6
+ from firebase_admin import credentials, firestore
7
+ import logging
8
+ from pathlib import Path
9
+ from time import perf_counter
10
+ from datetime import datetime
11
+ import gradio as gr
12
+ from jinja2 import Environment, FileSystemLoader
13
+ import numpy as np
14
+ from sentence_transformers import CrossEncoder
15
+
16
+ from backend.query_llm import generate_hf, generate_openai
17
+ from backend.semantic_search import table, retriever
18
+
19
+ VECTOR_COLUMN_NAME = "vector"
20
+ TEXT_COLUMN_NAME = "text"
21
+
22
+ proj_dir = Path(__file__).parent
23
+ # Setting up the logging
24
+ logging.basicConfig(level=logging.INFO)
25
+ logger = logging.getLogger(__name__)
26
+
27
+ # Set up the template environment with the templates directory
28
+ env = Environment(loader=FileSystemLoader(proj_dir / 'templates'))
29
+
30
+ # Load the templates directly from the environment
31
+ template = env.get_template('template.j2')
32
+ template_html = env.get_template('template_html.j2')
33
+ service_account_key='firebase.json'
34
+ # Create a Certificate object from the service account info
35
+ cred = credentials.Certificate(service_account_key)
36
+ # Initialize the Firebase Admin
37
+ firebase_admin.initialize_app(cred)
38
+
39
+ # # Create a reference to the Firestore database
40
+ db = firestore.client()
41
+
42
+ # Examples
43
+ examples = ['when i have to report to constituency?','what is social media and what are rules related to it for expenditure monitoring ',
44
+ 'how many reports to be submitted by Expenditure observer with annexure names ?','what is expenditure limits for parlimentary constituency and assembly constituency'
45
+ ]
46
+ #db usage
47
+ collection_name = 'Nirvachana' # Replace with your collection name
48
+ field_name = 'message_count' # Replace with your field name for count
49
+
50
+
51
+ def get_and_increment_value_count(db , collection_name, field_name):
52
+ """
53
+ Retrieves a value count from the specified Firestore collection and field,
54
+ increments it by 1, and updates the field with the new value."""
55
+ collection_ref = db.collection(collection_name)
56
+ doc_ref = collection_ref.document('count_doc') # Assuming a dedicated document for count
57
+
58
+ # Use a transaction to ensure consistency across reads and writes
59
+ try:
60
+ with db.transaction() as transaction:
61
+ # Get the current value count (or initialize to 0 if it doesn't exist)
62
+ current_count_doc = doc_ref.get()
63
+ current_count_data = current_count_doc.to_dict()
64
+ if current_count_data:
65
+ current_count = current_count_data.get(field_name, 0)
66
+ else:
67
+ current_count = 0
68
+ # Increment the count
69
+ new_count = current_count + 1
70
+ # Update the document with the new count
71
+ transaction.set(doc_ref, {field_name: new_count})
72
+ return new_count
73
+ except Exception as e:
74
+ print(f"Error retrieving and updating value count: {e}")
75
+ return None # Indicate error
76
+
77
+ def update_count_html():
78
+ usage_count = get_and_increment_value_count(db ,collection_name, field_name)
79
+ ccount_html = gr.HTML(value=f"""
80
+ <div style="display: flex; justify-content: flex-end;">
81
+ <span style="font-weight: bold; color: maroon; font-size: 18px;">No of Usages:</span>
82
+ <span style="font-weight: bold; color: maroon; font-size: 18px;">{usage_count}</span>
83
+ </div>
84
+ """)
85
+ return count_html
86
+
87
+ def store_message(db,query,answer,cross_encoder):
88
+ timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
89
+ # Create a new document reference with a dynamic document name based on timestamp
90
+ new_completion= db.collection('Nirvachana').document(f"chatlogs_{timestamp}")
91
+ new_completion.set({
92
+ 'query': query,
93
+ 'answer':answer,
94
+ 'created_time': firestore.SERVER_TIMESTAMP,
95
+ 'embedding': cross_encoder,
96
+ 'title': 'Expenditure observer bot'
97
+ })
98
+
99
+
100
+ def add_text(history, text):
101
+ history = [] if history is None else history
102
+ history = history + [(text, None)]
103
+ return history, gr.Textbox(value="", interactive=False)
104
+
105
+
106
+ def bot(history, cross_encoder):
107
+ top_rerank = 15
108
+ top_k_rank = 10
109
+ query = history[-1][0]
110
+
111
+ if not query:
112
+ gr.Warning("Please submit a non-empty string as a prompt")
113
+ raise ValueError("Empty string was submitted")
114
+
115
+ logger.warning('Retrieving documents...')
116
+
117
+ # if COLBERT RAGATATOUILLE PROCEDURE :
118
+ if cross_encoder=='(HIGH ACCURATE) ColBERT':
119
+ gr.Warning('Retrieving using ColBERT.. First time query will take a minute for model to load..pls wait')
120
+ RAG= RAGPretrainedModel.from_pretrained("colbert-ir/colbertv2.0")
121
+ RAG_db=RAG.from_index('.ragatouille/colbert/indexes/mockingbird')
122
+ documents_full=RAG_db.search(query,k=top_k_rank)
123
+
124
+ documents=[item['content'] for item in documents_full]
125
+ # Create Prompt
126
+ prompt = template.render(documents=documents, query=query)
127
+ prompt_html = template_html.render(documents=documents, query=query)
128
+
129
+ generate_fn = generate_hf
130
+
131
+ history[-1][1] = ""
132
+ for character in generate_fn(prompt, history[:-1]):
133
+ history[-1][1] = character
134
+ print('Final history is ',history)
135
+ yield history, prompt_html
136
+ store_message(db,history[-1][0],history[-1][1],cross_encoder)
137
+ else:
138
+ # Retrieve documents relevant to query
139
+ document_start = perf_counter()
140
+
141
+ query_vec = retriever.encode(query)
142
+ logger.warning(f'Finished query vec')
143
+ doc1 = table.search(query_vec, vector_column_name=VECTOR_COLUMN_NAME).limit(top_k_rank)
144
+
145
+
146
+
147
+ logger.warning(f'Finished search')
148
+ documents = table.search(query_vec, vector_column_name=VECTOR_COLUMN_NAME).limit(top_rerank).to_list()
149
+ documents = [doc[TEXT_COLUMN_NAME] for doc in documents]
150
+ logger.warning(f'start cross encoder {len(documents)}')
151
+ # Retrieve documents relevant to query
152
+ query_doc_pair = [[query, doc] for doc in documents]
153
+ if cross_encoder=='(FAST) MiniLM-L6v2' :
154
+ cross_encoder1 = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')
155
+ elif cross_encoder=='(ACCURATE) BGE reranker':
156
+ cross_encoder1 = CrossEncoder('BAAI/bge-reranker-base')
157
+
158
+ cross_scores = cross_encoder1.predict(query_doc_pair)
159
+ sim_scores_argsort = list(reversed(np.argsort(cross_scores)))
160
+ logger.warning(f'Finished cross encoder {len(documents)}')
161
+
162
+ documents = [documents[idx] for idx in sim_scores_argsort[:top_k_rank]]
163
+ logger.warning(f'num documents {len(documents)}')
164
+
165
+ document_time = perf_counter() - document_start
166
+ logger.warning(f'Finished Retrieving documents in {round(document_time, 2)} seconds...')
167
+
168
+ # Create Prompt
169
+ prompt = template.render(documents=documents, query=query)
170
+ prompt_html = template_html.render(documents=documents, query=query)
171
+
172
+ generate_fn = generate_hf
173
+
174
+ history[-1][1] = ""
175
+ for character in generate_fn(prompt, history[:-1]):
176
+ history[-1][1] = character
177
+ print('Final history is ',history)
178
+ yield history, prompt_html
179
+ store_message(db,history[-1][0],history[-1][1],cross_encoder)
180
+
181
+
182
+ with gr.Blocks(theme='Insuz/SimpleIndigo') as demo:
183
+ gr.HTML(value="""<div style="display: flex; align-items: center; justify-content: space-between;">
184
+ <h1 style="color: #008000">NIRVACHANA - <span style="color: #008000">Expenditure Observer AI Assistant</span></h1>
185
+ <img src='logo.png' alt="Chatbot" width="50" height="50" />
186
+ </div>""",elem_id='heading')
187
+ gr.HTML(value=f"""
188
+ <p style="font-family: sans-serif; font-size: 16px;">
189
+ A free chat bot assistant for Expenditure Observers on Compendium on Election Expenditure Monitoring using Open source LLMs. <br>
190
+ The bot can answer questions in natural language, taking relevant extracts from the ECI document which can be accessed <a href="https://www.eci.gov.in/eci-backend/public/api/download?url=LMAhAK6sOPBp%2FNFF0iRfXbEB1EVSLT41NNLRjYNJJP1KivrUxbfqkDatmHy12e%2Fzk1vx4ptJpQsKYHA87guoLjnPUWtHeZgKtEqs%2FyzfTTYIC0newOHHOjl1rl0u3mJBSIq%2Fi7zDsrcP74v%2FKr8UNw%3D%3D" style="color: #00008B; text-decoration: none;">CLICK HERE !</a>.
191
+ </p>
192
+ """, elem_id='Sub-heading')
193
+ usage_count = get_and_increment_value_count(db,collection_name, field_name)
194
+ gr.HTML(value=f"""<p style="font-family: Arial, sans-serif; font-size: 16px;">Developed by Ramesh M IRS (C& CE) (R-19187), Suggestions may be sent to <a href="mailto:mramesh.irs@gov.in" style="color: #00008B; font-style: italic;">mramesh.irs@gov.in</a>.</p>""", elem_id='Sub-heading1 ')
195
+ count_html = gr.HTML(value=f"""
196
+ <div style="display: flex; justify-content: flex-end;">
197
+ <span style="font-weight: bold; color: maroon; font-size: 18px;">No of Usages:</span>
198
+ <span style="font-weight: bold; color: maroon; font-size: 18px;">{usage_count}</span>
199
+ </div>
200
+ """)
201
+
202
+ chatbot = gr.Chatbot(
203
+ [],
204
+ elem_id="chatbot",
205
+ avatar_images=('https://aui.atlassian.com/aui/8.8/docs/images/avatar-person.svg',
206
+ 'https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg'),
207
+ bubble_full_width=False,
208
+ show_copy_button=True,
209
+ show_share_button=True,
210
+ )
211
+
212
+ with gr.Row():
213
+ txt = gr.Textbox(
214
+ scale=3,
215
+ show_label=False,
216
+ placeholder="Enter text and press enter",
217
+ container=False,
218
+ )
219
+ txt_btn = gr.Button(value="Submit text", scale=1)
220
+
221
+ cross_encoder = gr.Radio(choices=['(FAST) MiniLM-L6v2','(ACCURATE) BGE reranker','(HIGH ACCURATE) ColBERT'], value='(ACCURATE) BGE reranker',label="Embeddings", info="Only First query to Colbert may take litte time)")
222
+
223
+ prompt_html = gr.HTML()
224
+ # Turn off interactivity while generating if you click
225
+ txt_msg = txt_btn.click(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
226
+ bot, [chatbot, cross_encoder], [chatbot, prompt_html]).then(update_count_html,[],[count_html])
227
+
228
+ # Turn it back on
229
+ txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
230
+
231
+ # Turn off interactivity while generating if you hit enter
232
+ txt_msg = txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
233
+ bot, [chatbot, cross_encoder], [chatbot, prompt_html]).then(update_count_html,[],[count_html])
234
+
235
+ # Turn it back on
236
+ txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
237
+
238
+ # Examples
239
+ gr.Examples(examples, txt)
240
+
241
+ demo.queue()
242
+ demo.launch(debug=True)
lancedb1/cbse_class10_science.lance/_latest.manifest ADDED
Binary file (238 Bytes). View file
 
lancedb1/cbse_class10_science.lance/_transactions/0-2f4d59b6-1ec8-4d50-a5f0-32a1f0bf113f.txn ADDED
@@ -0,0 +1 @@
 
 
1
+ $2f4d59b6-1ec8-4d50-a5f0-32a1f0bf113f�Utext ���������*string084vector ���������*fixed_size_list:float:76808
lancedb1/cbse_class10_science.lance/_transactions/1-c7cdb2f8-5121-45e4-8959-c221951c9e4b.txn ADDED
Binary file (98 Bytes). View file
 
lancedb1/cbse_class10_science.lance/_versions/1.manifest ADDED
Binary file (183 Bytes). View file
 
lancedb1/cbse_class10_science.lance/_versions/2.manifest ADDED
Binary file (238 Bytes). View file
 
lancedb1/cbse_class10_science.lance/data/ba080219-f6f4-4264-958a-eebed06d25a6.lance ADDED
The diff for this file is too large to render. See raw diff
 
requirements (2).txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+
2
+ sentence-transformers==2.6.1
3
+ firebase_admin
4
+ huggingface-hub==0.19.3
5
+
6
+ ragatouille
7
+ transformers
8
+ lancedb