Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +5 -5
- training_triplets.jsonl +0 -0
app.py
CHANGED
@@ -14,13 +14,13 @@ is_hf_space = "SPACE_ID" in os.environ
|
|
14 |
|
15 |
if is_hf_space:
|
16 |
# In a Space, load model from the Hub and data from the repo root
|
17 |
-
model_path = os.environ.get("MODEL_REPO_ID", "philtoms/minilm-alice-base-rsft-
|
18 |
-
data_path = "
|
19 |
print(f"Running on HF Spaces. Using model from Hub: {model_path}")
|
20 |
else:
|
21 |
# Locally, construct absolute paths based on the script's location
|
22 |
-
model_path = os.path.join(script_dir, "..", "models", "minilm-alice-base-rsft-
|
23 |
-
data_path = os.path.join(script_dir, "..", "data", "
|
24 |
print(f"Running locally. Using local model at: {model_path}")
|
25 |
|
26 |
# --- Model and Tokenizer Loading ---
|
@@ -39,7 +39,7 @@ with open(data_path, "r") as f:
|
|
39 |
for line in f:
|
40 |
dataset.append(json.loads(line))
|
41 |
|
42 |
-
corpus = [item["
|
43 |
|
44 |
# Pre-compute corpus embeddings
|
45 |
with torch.no_grad():
|
|
|
14 |
|
15 |
if is_hf_space:
|
16 |
# In a Space, load model from the Hub and data from the repo root
|
17 |
+
model_path = os.environ.get("MODEL_REPO_ID", "philtoms/minilm-alice-base-rsft-v2")
|
18 |
+
data_path = "training_triplets.jsonl"
|
19 |
print(f"Running on HF Spaces. Using model from Hub: {model_path}")
|
20 |
else:
|
21 |
# Locally, construct absolute paths based on the script's location
|
22 |
+
model_path = os.path.join(script_dir, "..", "models", "minilm-alice-base-rsft-v2", "final")
|
23 |
+
data_path = os.path.join(script_dir, "..", "data", "training_triplets.jsonl")
|
24 |
print(f"Running locally. Using local model at: {model_path}")
|
25 |
|
26 |
# --- Model and Tokenizer Loading ---
|
|
|
39 |
for line in f:
|
40 |
dataset.append(json.loads(line))
|
41 |
|
42 |
+
corpus = [item["positive"] for item in dataset]
|
43 |
|
44 |
# Pre-compute corpus embeddings
|
45 |
with torch.no_grad():
|
training_triplets.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|