Ken Powers
commited on
New embed script
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .envrc +0 -1
- .python-version +1 -0
- README.md +1 -1
- embed-gemini.py +0 -54
- embed-ollama.py +0 -41
- embed-openai.py +0 -39
- embed-voyageai.py +0 -51
- embed.py +0 -32
- embeddings/{1 Chronicles/001/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/001.json} +0 -0
- embeddings/{1 Chronicles/002/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/002.json} +0 -0
- embeddings/{1 Chronicles/003/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/003.json} +0 -0
- embeddings/{1 Chronicles/004/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/004.json} +0 -0
- embeddings/{1 Chronicles/005/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/005.json} +0 -0
- embeddings/{1 Chronicles/006/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/006.json} +0 -0
- embeddings/{1 Chronicles/007/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/007.json} +0 -0
- embeddings/{1 Chronicles/008/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/008.json} +0 -0
- embeddings/{1 Chronicles/009/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/009.json} +0 -0
- embeddings/{1 Chronicles/010/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/010.json} +0 -0
- embeddings/{1 Chronicles/011/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/011.json} +0 -0
- embeddings/{1 Chronicles/012/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/012.json} +0 -0
- embeddings/{1 Chronicles/013/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/013.json} +0 -0
- embeddings/{1 Chronicles/014/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/014.json} +0 -0
- embeddings/{1 Chronicles/015/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/015.json} +0 -0
- embeddings/{1 Chronicles/016/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/016.json} +0 -0
- embeddings/{1 Chronicles/017/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/017.json} +0 -0
- embeddings/{1 Chronicles/018/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/018.json} +0 -0
- embeddings/{1 Chronicles/019/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/019.json} +0 -0
- embeddings/{1 Chronicles/020/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/020.json} +0 -0
- embeddings/{1 Chronicles/021/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/021.json} +0 -0
- embeddings/{1 Chronicles/022/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/022.json} +0 -0
- embeddings/{1 Chronicles/023/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/023.json} +0 -0
- embeddings/{1 Chronicles/024/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/024.json} +0 -0
- embeddings/{1 Chronicles/025/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/025.json} +0 -0
- embeddings/{1 Chronicles/026/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/026.json} +0 -0
- embeddings/{1 Chronicles/027/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/027.json} +0 -0
- embeddings/{1 Chronicles/028/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/028.json} +0 -0
- embeddings/{1 Chronicles/029/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/029.json} +0 -0
- embeddings/{1 Corinthians/001/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/001.json} +0 -0
- embeddings/{1 Corinthians/002/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/002.json} +0 -0
- embeddings/{1 Corinthians/003/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/003.json} +0 -0
- embeddings/{1 Corinthians/004/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/004.json} +0 -0
- embeddings/{1 Corinthians/005/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/005.json} +0 -0
- embeddings/{1 Corinthians/006/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/006.json} +0 -0
- embeddings/{1 Corinthians/007/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/007.json} +0 -0
- embeddings/{1 Corinthians/008/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/008.json} +0 -0
- embeddings/{1 Corinthians/009/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/009.json} +0 -0
- embeddings/{1 Corinthians/010/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/010.json} +0 -0
- embeddings/{1 Corinthians/011/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/011.json} +0 -0
- embeddings/{1 Corinthians/012/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/012.json} +0 -0
- embeddings/{1 Corinthians/013/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/013.json} +0 -0
.envrc
CHANGED
|
@@ -1,3 +1,2 @@
|
|
| 1 |
source_up_if_exists
|
| 2 |
source_env_if_exists ./.envrc.local
|
| 3 |
-
layout anaconda bible-embeddings
|
|
|
|
| 1 |
source_up_if_exists
|
| 2 |
source_env_if_exists ./.envrc.local
|
|
|
.python-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
3.13
|
README.md
CHANGED
|
@@ -83,7 +83,7 @@ For high-level information about these models, see the [MTEB Leaderboard](https:
|
|
| 83 |
- [intfloat/e5-small-v2](https://huggingface.co/intfloat/e5-small-v2)
|
| 84 |
- 384 dimensions
|
| 85 |
- BSB: 336.522 MB
|
| 86 |
-
- [jinaai/jina-embeddings-v3]
|
| 87 |
- 1024 dimensions
|
| 88 |
- BSB: 738.597 MB
|
| 89 |
- [nvidia/NV-Embed-V2](https://huggingface.co/nvidia/NV-Embed-V2)
|
|
|
|
| 83 |
- [intfloat/e5-small-v2](https://huggingface.co/intfloat/e5-small-v2)
|
| 84 |
- 384 dimensions
|
| 85 |
- BSB: 336.522 MB
|
| 86 |
+
- [jinaai/jina-embeddings-v3](https://huggingface.co/jinaai/jina-embeddings-v3)
|
| 87 |
- 1024 dimensions
|
| 88 |
- BSB: 738.597 MB
|
| 89 |
- [nvidia/NV-Embed-V2](https://huggingface.co/nvidia/NV-Embed-V2)
|
embed-gemini.py
DELETED
|
@@ -1,54 +0,0 @@
|
|
| 1 |
-
import argparse
|
| 2 |
-
import json
|
| 3 |
-
import os
|
| 4 |
-
from google import genai
|
| 5 |
-
import logging
|
| 6 |
-
from itertools import groupby
|
| 7 |
-
from more_itertools import chunked
|
| 8 |
-
from tenacity import retry, wait_exponential, before_sleep_log
|
| 9 |
-
|
| 10 |
-
logging.basicConfig(level=logging.INFO)
|
| 11 |
-
logger = logging.getLogger(__name__)
|
| 12 |
-
|
| 13 |
-
arg_parser = argparse.ArgumentParser(prog="embed-gemini", description="Creates embeddings of Bible verses using Gemini API")
|
| 14 |
-
arg_parser.add_argument("translation", help="Located at text/<translation>.json")
|
| 15 |
-
arg_parser.add_argument("model", help="Gemini model")
|
| 16 |
-
|
| 17 |
-
args = arg_parser.parse_args()
|
| 18 |
-
|
| 19 |
-
with open(f"text/{args.translation}.json") as f:
|
| 20 |
-
bible_data = [verse for verse in json.load(f) if len(verse["text"]) > 0]
|
| 21 |
-
|
| 22 |
-
grouped_bible_data = groupby(bible_data, lambda item: (item["book"], item["chapter"]))
|
| 23 |
-
|
| 24 |
-
model_name = args.model
|
| 25 |
-
|
| 26 |
-
client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
|
| 27 |
-
|
| 28 |
-
@retry(wait=wait_exponential(multiplier=2, min=60, max=300), before_sleep=before_sleep_log(logger, logging.WARNING))
|
| 29 |
-
def call_embeddings_api(sentences):
|
| 30 |
-
response = client.models.embed_content(model=model_name, contents=sentences)
|
| 31 |
-
return response
|
| 32 |
-
|
| 33 |
-
def get_embeddings(sentences):
|
| 34 |
-
all_embeddings = []
|
| 35 |
-
batch_size = 100 # API limit
|
| 36 |
-
|
| 37 |
-
for batch in chunked(sentences, batch_size):
|
| 38 |
-
response = call_embeddings_api(batch)
|
| 39 |
-
all_embeddings.extend(embedding.values for embedding in response.embeddings)
|
| 40 |
-
|
| 41 |
-
return all_embeddings
|
| 42 |
-
|
| 43 |
-
for (book, chapter), grouped in grouped_bible_data:
|
| 44 |
-
print(f"Embedding {book} {chapter}")
|
| 45 |
-
verses = list(grouped)
|
| 46 |
-
data = []
|
| 47 |
-
base_path = os.path.join("embeddings", book, str(chapter).zfill(3))
|
| 48 |
-
os.makedirs(base_path, exist_ok=True)
|
| 49 |
-
sentences = [verse["text"] for verse in verses]
|
| 50 |
-
embeddings = get_embeddings(sentences)
|
| 51 |
-
for i, verse in enumerate(verses):
|
| 52 |
-
data.append({ "book": verse["book"], "chapter": verse["chapter"], "verse": verse["verse"], "embedding": embeddings[i] })
|
| 53 |
-
with open(os.path.join(base_path, f"{args.translation}-{model_name}.json"), "w", encoding='utf-8') as f:
|
| 54 |
-
json.dump(data, f, indent=2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
embed-ollama.py
DELETED
|
@@ -1,41 +0,0 @@
|
|
| 1 |
-
import argparse
|
| 2 |
-
import json
|
| 3 |
-
import ollama
|
| 4 |
-
import os
|
| 5 |
-
from itertools import groupby
|
| 6 |
-
import numpy as np
|
| 7 |
-
|
| 8 |
-
arg_parser = argparse.ArgumentParser(prog="embed-ollama", description="Creates embeddings of Bible verses using Ollama")
|
| 9 |
-
arg_parser.add_argument("translation", help="Located at text/<translation>.json")
|
| 10 |
-
arg_parser.add_argument("model", help="Ollama model")
|
| 11 |
-
|
| 12 |
-
args = arg_parser.parse_args()
|
| 13 |
-
|
| 14 |
-
with open(f"text/{args.translation}.json") as f:
|
| 15 |
-
bible_data = [verse for verse in json.load(f) if len(verse["text"]) > 0]
|
| 16 |
-
|
| 17 |
-
grouped_bible_data = groupby(bible_data, lambda item: (item["book"], item["chapter"]))
|
| 18 |
-
|
| 19 |
-
model_name = args.model
|
| 20 |
-
|
| 21 |
-
def get_embeddings(sentences):
|
| 22 |
-
embeddings = []
|
| 23 |
-
for _, s in enumerate(sentences):
|
| 24 |
-
res = ollama.embeddings(model=model_name, prompt=s)
|
| 25 |
-
embedding = np.array(res["embedding"])
|
| 26 |
-
norm = np.linalg.norm(embedding)
|
| 27 |
-
embeddings.append((embedding / norm).tolist())
|
| 28 |
-
return embeddings
|
| 29 |
-
|
| 30 |
-
for (book, chapter), grouped in grouped_bible_data:
|
| 31 |
-
print(f"Embedding {book} {chapter}")
|
| 32 |
-
verses = list(grouped)
|
| 33 |
-
data = []
|
| 34 |
-
base_path = os.path.join("embeddings", book, str(chapter).zfill(3))
|
| 35 |
-
os.makedirs(base_path, exist_ok=True)
|
| 36 |
-
sentences = [verse["text"] for verse in verses]
|
| 37 |
-
embeddings = get_embeddings(sentences)
|
| 38 |
-
for i, verse in enumerate(verses):
|
| 39 |
-
data.append({ "book": verse["book"], "chapter": verse["chapter"], "verse": verse["verse"], "embedding": embeddings[i] })
|
| 40 |
-
with open(os.path.join(base_path, f"{args.translation}-{model_name.replace("/", "__")}.json"), "w", encoding='utf-8') as f:
|
| 41 |
-
json.dump(data, f, indent=2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
embed-openai.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
| 1 |
-
import argparse
|
| 2 |
-
import json
|
| 3 |
-
import os
|
| 4 |
-
import openai
|
| 5 |
-
from itertools import groupby
|
| 6 |
-
from tenacity import retry, wait_exponential, before_sleep_log
|
| 7 |
-
|
| 8 |
-
logging.basicConfig(level=logging.INFO)
|
| 9 |
-
logger = logging.getLogger(__name__)
|
| 10 |
-
|
| 11 |
-
arg_parser = argparse.ArgumentParser(prog="embed-openai", description="Creates embeddings of Bible verses using OpenAI API")
|
| 12 |
-
arg_parser.add_argument("translation", help="Located at text/<translation>.json")
|
| 13 |
-
arg_parser.add_argument("model", help="OpenAI model")
|
| 14 |
-
|
| 15 |
-
args = arg_parser.parse_args()
|
| 16 |
-
|
| 17 |
-
with open(f"text/{args.translation}.json") as f:
|
| 18 |
-
bible_data = [verse for verse in json.load(f) if len(verse["text"]) > 0]
|
| 19 |
-
|
| 20 |
-
grouped_bible_data = groupby(bible_data, lambda item: (item["book"], item["chapter"]))
|
| 21 |
-
|
| 22 |
-
model_name = args.model
|
| 23 |
-
|
| 24 |
-
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), before_sleep=before_sleep_log(logger, logging.WARNING))
|
| 25 |
-
def get_embeddings(sentences):
|
| 26 |
-
return openai.Embedding.create(input=sentences, model=model_name)["data"]
|
| 27 |
-
|
| 28 |
-
for (book, chapter), grouped in grouped_bible_data:
|
| 29 |
-
print(f"Embedding {book} {chapter}")
|
| 30 |
-
verses = list(grouped)
|
| 31 |
-
data = []
|
| 32 |
-
base_path = os.path.join("embeddings", book, str(chapter).zfill(3))
|
| 33 |
-
os.makedirs(base_path, exist_ok=True)
|
| 34 |
-
sentences = [verse["text"] for verse in verses]
|
| 35 |
-
embeddings = get_embeddings(sentences)
|
| 36 |
-
for i, verse in enumerate(verses):
|
| 37 |
-
data.append({ "book": verse["book"], "chapter": verse["chapter"], "verse": verse["verse"], "embedding": embeddings[i]["embedding"] })
|
| 38 |
-
with open(os.path.join(base_path, f"{args.translation}-{model_name}.json"), "w", encoding='utf-8') as f:
|
| 39 |
-
json.dump(data, f, indent=2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
embed-voyageai.py
DELETED
|
@@ -1,51 +0,0 @@
|
|
| 1 |
-
import argparse
|
| 2 |
-
import json
|
| 3 |
-
import os
|
| 4 |
-
import voyageai
|
| 5 |
-
from itertools import groupby
|
| 6 |
-
import logging
|
| 7 |
-
from tenacity import retry, wait_exponential, before_sleep_log
|
| 8 |
-
|
| 9 |
-
logging.basicConfig(level=logging.INFO)
|
| 10 |
-
logger = logging.getLogger(__name__)
|
| 11 |
-
|
| 12 |
-
arg_parser = argparse.ArgumentParser(prog="embed-voyageai", description="Creates embeddings of Bible verses using VoyageAI API")
|
| 13 |
-
arg_parser.add_argument("translation", help="Located at text/<translation>.json")
|
| 14 |
-
arg_parser.add_argument("model", help="VoyageAI model")
|
| 15 |
-
|
| 16 |
-
args = arg_parser.parse_args()
|
| 17 |
-
|
| 18 |
-
vo = voyageai.Client()
|
| 19 |
-
|
| 20 |
-
with open(f"text/{args.translation}.json") as f:
|
| 21 |
-
bible_data = [verse for verse in json.load(f) if len(verse["text"]) > 0]
|
| 22 |
-
|
| 23 |
-
grouped_bible_data = groupby(bible_data, lambda item: (item["book"], item["chapter"]))
|
| 24 |
-
|
| 25 |
-
model_name = args.model
|
| 26 |
-
|
| 27 |
-
def chunk_sentences(sentences, chunk_size=128):
|
| 28 |
-
"""Split sentences into chunks of specified size."""
|
| 29 |
-
for i in range(0, len(sentences), chunk_size):
|
| 30 |
-
yield sentences[i:i + chunk_size]
|
| 31 |
-
|
| 32 |
-
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), before_sleep=before_sleep_log(logger, logging.WARNING))
|
| 33 |
-
def get_embeddings(sentences):
|
| 34 |
-
all_embeddings = []
|
| 35 |
-
for chunk in chunk_sentences(sentences):
|
| 36 |
-
embeddings = vo.embed(texts=chunk, model=model_name).embeddings
|
| 37 |
-
all_embeddings.extend(embeddings)
|
| 38 |
-
return all_embeddings
|
| 39 |
-
|
| 40 |
-
for (book, chapter), grouped in grouped_bible_data:
|
| 41 |
-
print(f"Embedding {book} {chapter}")
|
| 42 |
-
verses = list(grouped)
|
| 43 |
-
data = []
|
| 44 |
-
base_path = os.path.join("embeddings", book, str(chapter).zfill(3))
|
| 45 |
-
os.makedirs(base_path, exist_ok=True)
|
| 46 |
-
sentences = [verse["text"] for verse in verses]
|
| 47 |
-
embeddings = get_embeddings(sentences)
|
| 48 |
-
for i, verse in enumerate(verses):
|
| 49 |
-
data.append({ "book": verse["book"], "chapter": verse["chapter"], "verse": verse["verse"], "embedding": embeddings[i] })
|
| 50 |
-
with open(os.path.join(base_path, f"{args.translation}-{model_name}.json"), "w", encoding='utf-8') as f:
|
| 51 |
-
json.dump(data, f, indent=2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
embed.py
DELETED
|
@@ -1,32 +0,0 @@
|
|
| 1 |
-
import argparse
|
| 2 |
-
import json
|
| 3 |
-
import os
|
| 4 |
-
from itertools import groupby
|
| 5 |
-
from sentence_transformers import SentenceTransformer
|
| 6 |
-
|
| 7 |
-
arg_parser = argparse.ArgumentParser(prog="embed", description="Creates embeddings of Bible verses")
|
| 8 |
-
arg_parser.add_argument("translation", help="Located at text/<translation>.json")
|
| 9 |
-
arg_parser.add_argument("model", help="SentenceTransformer model")
|
| 10 |
-
|
| 11 |
-
args = arg_parser.parse_args()
|
| 12 |
-
|
| 13 |
-
with open(f"text/{args.translation}.json") as f:
|
| 14 |
-
bible_data = json.load(f)
|
| 15 |
-
|
| 16 |
-
grouped_bible_data = groupby(bible_data, lambda item: (item["book"], item["chapter"]))
|
| 17 |
-
|
| 18 |
-
model = SentenceTransformer(args.model, trust_remote_code=True)
|
| 19 |
-
model_name = args.model.split("/")[-1]
|
| 20 |
-
|
| 21 |
-
for (book, chapter), grouped in grouped_bible_data:
|
| 22 |
-
print(f"Embedding {book} {chapter}")
|
| 23 |
-
verses = list(grouped)
|
| 24 |
-
data = []
|
| 25 |
-
base_path = os.path.join("embeddings", book, str(chapter).zfill(3))
|
| 26 |
-
os.makedirs(base_path, exist_ok=True)
|
| 27 |
-
sentences = [verse["text"] for verse in verses]
|
| 28 |
-
embeddings = model.encode(sentences, normalize_embeddings=True)
|
| 29 |
-
for i, verse in enumerate(verses):
|
| 30 |
-
data.append({ "book": verse["book"], "chapter": verse["chapter"], "verse": verse["verse"], "embedding": embeddings[i].tolist() })
|
| 31 |
-
with open(os.path.join(base_path, f"{args.translation}-{model_name}.json"), "w", encoding='utf-8') as f:
|
| 32 |
-
json.dump(data, f, indent=2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
embeddings/{1 Chronicles/001/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/001.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/002/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/002.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/003/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/003.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/004/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/004.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/005/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/005.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/006/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/006.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/007/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/007.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/008/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/008.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/009/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/009.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/010/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/010.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/011/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/011.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/012/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/012.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/013/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/013.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/014/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/014.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/015/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/015.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/016/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/016.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/017/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/017.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/018/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/018.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/019/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/019.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/020/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/020.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/021/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/021.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/022/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/022.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/023/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/023.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/024/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/024.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/025/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/025.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/026/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/026.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/027/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/027.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/028/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/028.json}
RENAMED
|
File without changes
|
embeddings/{1 Chronicles/029/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Chronicles/029.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/001/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/001.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/002/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/002.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/003/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/003.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/004/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/004.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/005/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/005.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/006/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/006.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/007/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/007.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/008/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/008.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/009/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/009.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/010/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/010.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/011/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/011.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/012/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/012.json}
RENAMED
|
File without changes
|
embeddings/{1 Corinthians/013/bsb-text-embedding-004.json → google-gemini/text-embedding-004/1 Corinthians/013.json}
RENAMED
|
File without changes
|