martinhillebrandtd commited on
Commit
89ed83e
·
verified ·
1 Parent(s): 82b9d4f

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +4 -4
README.md CHANGED
@@ -68,7 +68,7 @@ chunks_table = "your_chunks_table" # columns: chunk_id, chunk_txt
68
  QUERY = "What is the best-known landmark in Paris?"
69
 
70
  query = f"""
71
- SELECT chunk_id, chunk_txt, emb_1 AS relevance_score
72
  FROM mldb.ONNXEmbeddings(
73
  ON (SELECT chunk_id, chunk_txt, '{QUERY}' || '</s></s>' || chunk_txt AS txt
74
  FROM {chunks_table}) AS InputTable
@@ -86,7 +86,7 @@ result = tdml.DataFrame.from_query(query).to_pandas().sort_values("relevance_sco
86
 
87
  `relevance_score` is the model's raw logit -- sorting by it directly already gives the correct
88
  ranking, since `sigmoid` is monotonic. If you need an actual `[0, 1]` probability rather than
89
- just a ranking, compute it in SQL instead of Python: `1 / (1 + EXP(-emb_1))`.
90
 
91
  ## Combining with vector search for two-stage retrieval
92
 
@@ -103,9 +103,9 @@ CREATE VOLATILE TABLE shortlist AS (
103
  ON chunk_embeddings AS ReferenceTable DIMENSION
104
  USING
105
  TargetIDColumn('query_id')
106
- TargetFeatureColumns('[emb_1:emb_384]')
107
  RefIDColumn('chunk_id')
108
- RefFeatureColumns('[emb_1:emb_384]')
109
  DistanceMeasure('cosine')
110
  TopK(20)
111
  ) AS dt
 
68
  QUERY = "What is the best-known landmark in Paris?"
69
 
70
  query = f"""
71
+ SELECT chunk_id, chunk_txt, emb_0 AS relevance_score
72
  FROM mldb.ONNXEmbeddings(
73
  ON (SELECT chunk_id, chunk_txt, '{QUERY}' || '</s></s>' || chunk_txt AS txt
74
  FROM {chunks_table}) AS InputTable
 
86
 
87
  `relevance_score` is the model's raw logit -- sorting by it directly already gives the correct
88
  ranking, since `sigmoid` is monotonic. If you need an actual `[0, 1]` probability rather than
89
+ just a ranking, compute it in SQL instead of Python: `1 / (1 + EXP(-emb_0))`.
90
 
91
  ## Combining with vector search for two-stage retrieval
92
 
 
103
  ON chunk_embeddings AS ReferenceTable DIMENSION
104
  USING
105
  TargetIDColumn('query_id')
106
+ TargetFeatureColumns('[emb_0:emb_383]')
107
  RefIDColumn('chunk_id')
108
+ RefFeatureColumns('[emb_0:emb_383]')
109
  DistanceMeasure('cosine')
110
  TopK(20)
111
  ) AS dt