Skip to content

Commit 3d96afe

Browse files
committed
implement import
1 parent db4e16a commit 3d96afe

5 files changed

Lines changed: 6 additions & 9 deletions

File tree

setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
description="A bilingual BPE tokenizer trained on English + Hindi transcripts",
88
packages=find_packages(),
99
package_data={
10-
"tokenizer": [
11-
"../data/vocab.json",
12-
"../data/merges.txt",
13-
]
10+
"tewtoken": ["vocab.json", "merges.txt"] # ← updated path
1411
},
1512
python_requires=">=3.7",
1613
)

tewtoken/bpe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ def merge_pair(pair, vocab):
128128
print(f"\nFinal vocab size: {len(token_to_id)}")
129129

130130
#Save vocab ────────────────────────────────────────────
131-
with open(r"F:\RandomProjects\tewtoken\data\vocab.json", "w", encoding="utf-8") as f:
131+
with open(r"/tewtoken/vocab.json", "w", encoding="utf-8") as f:
132132
json.dump(token_to_id, f, ensure_ascii=False, indent=2)
133133

134134
print("Saved vocab.json")
135135

136136
#Save merges ───────────────────────────────────────────
137-
with open(r"F:\RandomProjects\tewtoken\data\merges.txt", "w", encoding="utf-8") as f:
137+
with open(r"/tewtoken/merges.txt", "w", encoding="utf-8") as f:
138138
for pair in merges:
139139
f.write(f"{pair[0]} {pair[1]}\n")
140140

File renamed without changes.

tewtoken/tokeniser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import os
44

55
# ── 1. Dynamic paths ─────────────────────────────────────────
6-
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
7-
VOCAB_PATH = os.path.join(BASE_DIR, "data", "vocab.json")
8-
MERGES_PATH = os.path.join(BASE_DIR, "data", "merges.txt")
6+
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
7+
VOCAB_PATH = os.path.join(BASE_DIR, "vocab.json")
8+
MERGES_PATH = os.path.join(BASE_DIR, "merges.txt")
99

1010
# ── 2. Load vocab and merges ─────────────────────────────────
1111
with open(VOCAB_PATH, "r", encoding="utf-8") as f:
File renamed without changes.

0 commit comments

Comments
 (0)