AAJerry commited on
Commit
72effb0
·
verified ·
1 Parent(s): 882d7d7

Stage validated dataset and base model during free build

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ data/dataset/train.jsonl filter=lfs diff=lfs merge=lfs -text
37
+ prepared_dataset/train.jsonl filter=lfs diff=lfs merge=lfs -text
Dockerfile CHANGED
@@ -19,6 +19,10 @@ COPY requirements.txt .
19
  RUN python -m pip install --no-cache-dir --upgrade pip && \
20
  python -m pip install --no-cache-dir -r requirements.txt
21
 
 
 
 
 
22
  # Pinned official llama.cpp revision for reproducible GGUF conversion.
23
  RUN git clone https://github.com/ggml-org/llama.cpp.git /opt/llama.cpp && \
24
  cd /opt/llama.cpp && \
 
19
  RUN python -m pip install --no-cache-dir --upgrade pip && \
20
  python -m pip install --no-cache-dir -r requirements.txt
21
 
22
+ # Cache the public base model while the Space image is building. Hugging Face
23
+ # does not bill requested GPU hardware during the build stage.
24
+ RUN python -c "from huggingface_hub import snapshot_download; snapshot_download('Qwen/Qwen3-1.7B')"
25
+
26
  # Pinned official llama.cpp revision for reproducible GGUF conversion.
27
  RUN git clone https://github.com/ggml-org/llama.cpp.git /opt/llama.cpp && \
28
  cd /opt/llama.cpp && \
data/dataset/manifest.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "actual_examples": 7925,
3
+ "categories": {
4
+ "activity_context": 96,
5
+ "adversarial_input": 500,
6
+ "altitude_telemetry": 23,
7
+ "communications_loss": 400,
8
+ "missing_stale_data": 800,
9
+ "mountain_knowledge": 50,
10
+ "multi_turn_checkin": 600,
11
+ "noisy_speech": 600,
12
+ "telemetry_safety": 4748,
13
+ "wearable_reliability": 108
14
+ },
15
+ "notes": [
16
+ "Harespod values are treated as normalized research signals, not clinical units.",
17
+ "MedSafetyBench is excluded from SFT and reserved for evaluation.",
18
+ "Synthetic records are policy-grounded and explicitly marked in metadata.",
19
+ "Splits are grouped by source subject or scenario family to reduce leakage."
20
+ ],
21
+ "ppg_dalia_available": false,
22
+ "seed": 42,
23
+ "sources": {
24
+ "cdc-yellow-book-altitude-2026": 45,
25
+ "harespod": 23,
26
+ "mhealth": 108,
27
+ "pamap2": 96,
28
+ "synthetic-policy-grounded": 7648,
29
+ "wms-wc24-altitude-syllabus": 5
30
+ },
31
+ "splits": {
32
+ "test": 714,
33
+ "train": 6489,
34
+ "validation": 722
35
+ },
36
+ "target_examples": 8000
37
+ }
data/dataset/test.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/dataset/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:452b92ef1a1f2c6bd65027d1688a3ec999410046284278342a7f31adbe735a7e
3
+ size 10895160
data/dataset/validation.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/dataset/validation_report.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "actions": {
3
+ "ACTIVATE_EMERGENCY": 751,
4
+ "CONTINUE_MONITORING": 666,
5
+ "HOLD_ASCENT": 2318,
6
+ "RECHECK_SENSOR": 3767,
7
+ "REQUEST_HUMAN_REVIEW": 423
8
+ },
9
+ "categories": {
10
+ "activity_context": 96,
11
+ "adversarial_input": 500,
12
+ "altitude_telemetry": 23,
13
+ "communications_loss": 400,
14
+ "missing_stale_data": 800,
15
+ "mountain_knowledge": 50,
16
+ "multi_turn_checkin": 600,
17
+ "noisy_speech": 600,
18
+ "telemetry_safety": 4748,
19
+ "wearable_reliability": 108
20
+ },
21
+ "counts": {
22
+ "test": 714,
23
+ "train": 6489,
24
+ "validation": 722
25
+ },
26
+ "errors": [],
27
+ "ok": true,
28
+ "unique_groups": 2443,
29
+ "warnings": []
30
+ }
data/logs/events.jsonl ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {"actual_examples": 8000, "categories": {"adversarial_input": 500, "communications_loss": 400, "missing_stale_data": 800, "mountain_knowledge": 50, "multi_turn_checkin": 600, "noisy_speech": 600, "telemetry_safety": 5050}, "event": "dataset_built", "notes": ["Harespod values are treated as normalized research signals, not clinical units.", "MedSafetyBench is excluded from SFT and reserved for evaluation.", "Synthetic records are policy-grounded and explicitly marked in metadata.", "Splits are grouped by source subject or scenario family to reduce leakage."], "ppg_dalia_available": false, "seed": 42, "sources": {"cdc-yellow-book-altitude-2026": 45, "synthetic-policy-grounded": 7950, "wms-wc24-altitude-syllabus": 5}, "splits": {"test": 708, "train": 6542, "validation": 750}, "target_examples": 8000, "time": "2026-08-29T23:49:51.358270+00:00"}
2
+ {"actions": {"ACTIVATE_EMERGENCY": 768, "CONTINUE_MONITORING": 529, "HOLD_ASCENT": 2419, "RECHECK_SENSOR": 3884, "REQUEST_HUMAN_REVIEW": 400}, "categories": {"adversarial_input": 500, "communications_loss": 400, "missing_stale_data": 800, "mountain_knowledge": 50, "multi_turn_checkin": 600, "noisy_speech": 600, "telemetry_safety": 5050}, "counts": {"test": 708, "train": 6542, "validation": 750}, "errors": [], "event": "dataset_validated", "ok": true, "time": "2026-08-29T23:49:52.217503+00:00", "unique_groups": 2490, "warnings": []}
3
+ {"event": "prepared_dataset_staged", "files": ["train.jsonl", "validation.jsonl", "test.jsonl", "manifest.json", "validation_report.json"], "time": "2026-08-30T01:08:33.736347+00:00"}
4
+ {"actions": {"ACTIVATE_EMERGENCY": 751, "CONTINUE_MONITORING": 666, "HOLD_ASCENT": 2318, "RECHECK_SENSOR": 3767, "REQUEST_HUMAN_REVIEW": 423}, "categories": {"activity_context": 96, "adversarial_input": 500, "altitude_telemetry": 23, "communications_loss": 400, "missing_stale_data": 800, "mountain_knowledge": 50, "multi_turn_checkin": 600, "noisy_speech": 600, "telemetry_safety": 4748, "wearable_reliability": 108}, "counts": {"test": 714, "train": 6489, "validation": 722}, "errors": [], "event": "dataset_validated", "ok": true, "time": "2026-08-30T01:08:34.572972+00:00", "unique_groups": 2443, "warnings": []}
data/status/status.json ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dataset": {
3
+ "actual_examples": 8000,
4
+ "categories": {
5
+ "adversarial_input": 500,
6
+ "communications_loss": 400,
7
+ "missing_stale_data": 800,
8
+ "mountain_knowledge": 50,
9
+ "multi_turn_checkin": 600,
10
+ "noisy_speech": 600,
11
+ "telemetry_safety": 5050
12
+ },
13
+ "notes": [
14
+ "Harespod values are treated as normalized research signals, not clinical units.",
15
+ "MedSafetyBench is excluded from SFT and reserved for evaluation.",
16
+ "Synthetic records are policy-grounded and explicitly marked in metadata.",
17
+ "Splits are grouped by source subject or scenario family to reduce leakage."
18
+ ],
19
+ "ppg_dalia_available": false,
20
+ "seed": 42,
21
+ "sources": {
22
+ "cdc-yellow-book-altitude-2026": 45,
23
+ "synthetic-policy-grounded": 7950,
24
+ "wms-wc24-altitude-syllabus": 5
25
+ },
26
+ "splits": {
27
+ "test": 708,
28
+ "train": 6542,
29
+ "validation": 750
30
+ },
31
+ "target_examples": 8000
32
+ },
33
+ "message": "Dataset validation passed",
34
+ "phase": "dataset_valid",
35
+ "pid": 39260,
36
+ "updated_at": "2026-08-30T01:08:34.574191+00:00",
37
+ "validation": {
38
+ "actions": {
39
+ "ACTIVATE_EMERGENCY": 751,
40
+ "CONTINUE_MONITORING": 666,
41
+ "HOLD_ASCENT": 2318,
42
+ "RECHECK_SENSOR": 3767,
43
+ "REQUEST_HUMAN_REVIEW": 423
44
+ },
45
+ "categories": {
46
+ "activity_context": 96,
47
+ "adversarial_input": 500,
48
+ "altitude_telemetry": 23,
49
+ "communications_loss": 400,
50
+ "missing_stale_data": 800,
51
+ "mountain_knowledge": 50,
52
+ "multi_turn_checkin": 600,
53
+ "noisy_speech": 600,
54
+ "telemetry_safety": 4748,
55
+ "wearable_reliability": 108
56
+ },
57
+ "counts": {
58
+ "test": 714,
59
+ "train": 6489,
60
+ "validation": 722
61
+ },
62
+ "errors": [],
63
+ "ok": true,
64
+ "unique_groups": 2443,
65
+ "warnings": []
66
+ }
67
+ }
prepared_dataset/manifest.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "actual_examples": 7925,
3
+ "categories": {
4
+ "activity_context": 96,
5
+ "adversarial_input": 500,
6
+ "altitude_telemetry": 23,
7
+ "communications_loss": 400,
8
+ "missing_stale_data": 800,
9
+ "mountain_knowledge": 50,
10
+ "multi_turn_checkin": 600,
11
+ "noisy_speech": 600,
12
+ "telemetry_safety": 4748,
13
+ "wearable_reliability": 108
14
+ },
15
+ "notes": [
16
+ "Harespod values are treated as normalized research signals, not clinical units.",
17
+ "MedSafetyBench is excluded from SFT and reserved for evaluation.",
18
+ "Synthetic records are policy-grounded and explicitly marked in metadata.",
19
+ "Splits are grouped by source subject or scenario family to reduce leakage."
20
+ ],
21
+ "ppg_dalia_available": false,
22
+ "seed": 42,
23
+ "sources": {
24
+ "cdc-yellow-book-altitude-2026": 45,
25
+ "harespod": 23,
26
+ "mhealth": 108,
27
+ "pamap2": 96,
28
+ "synthetic-policy-grounded": 7648,
29
+ "wms-wc24-altitude-syllabus": 5
30
+ },
31
+ "splits": {
32
+ "test": 714,
33
+ "train": 6489,
34
+ "validation": 722
35
+ },
36
+ "target_examples": 8000
37
+ }
prepared_dataset/test.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
prepared_dataset/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:452b92ef1a1f2c6bd65027d1688a3ec999410046284278342a7f31adbe735a7e
3
+ size 10895160
prepared_dataset/validation.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
prepared_dataset/validation_report.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "actions": {
3
+ "ACTIVATE_EMERGENCY": 751,
4
+ "CONTINUE_MONITORING": 666,
5
+ "HOLD_ASCENT": 2318,
6
+ "RECHECK_SENSOR": 3767,
7
+ "REQUEST_HUMAN_REVIEW": 423
8
+ },
9
+ "categories": {
10
+ "activity_context": 96,
11
+ "adversarial_input": 500,
12
+ "altitude_telemetry": 23,
13
+ "communications_loss": 400,
14
+ "missing_stale_data": 800,
15
+ "mountain_knowledge": 50,
16
+ "multi_turn_checkin": 600,
17
+ "noisy_speech": 600,
18
+ "telemetry_safety": 4748,
19
+ "wearable_reliability": 108
20
+ },
21
+ "counts": {
22
+ "test": 714,
23
+ "train": 6489,
24
+ "validation": 722
25
+ },
26
+ "errors": [],
27
+ "ok": true,
28
+ "unique_groups": 2443,
29
+ "warnings": []
30
+ }
trainer/run_pipeline.py CHANGED
@@ -1,6 +1,7 @@
1
  from __future__ import annotations
2
 
3
  import os
 
4
  import subprocess
5
  import sys
6
  import traceback
@@ -8,7 +9,17 @@ from pathlib import Path
8
 
9
  from huggingface_hub import HfApi
10
 
11
- from .common import ARTIFACT_ROOT, STATUS_ROOT, ensure_dirs, fail, log_event, update_status, wait_for_gpu
 
 
 
 
 
 
 
 
 
 
12
 
13
 
14
  STAGES = [
@@ -21,6 +32,15 @@ STAGES = [
21
  ("merge_export", "trainer.merge_and_export"),
22
  ]
23
 
 
 
 
 
 
 
 
 
 
24
 
25
  def run_module(name: str, extra_env: dict[str, str] | None = None) -> None:
26
  env = os.environ.copy()
@@ -28,6 +48,20 @@ def run_module(name: str, extra_env: dict[str, str] | None = None) -> None:
28
  subprocess.run([sys.executable, "-m", name], check=True, env=env)
29
 
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  def upload_artifacts() -> str:
32
  token = os.environ.get("TRAINING_HF_TOKEN")
33
  repo_id = os.environ.get("OUTPUT_MODEL_REPO", "iteratehack/sam-qwen3-1.7b-mountain")
@@ -78,8 +112,9 @@ def main() -> None:
78
  lock.write_text(str(os.getpid()), encoding="utf-8")
79
  try:
80
  update_status("starting", "Pipeline started")
81
- run_module("trainer.download_sources")
82
- run_module("trainer.build_dataset")
 
83
  run_module("trainer.validate_dataset")
84
  wait_for_gpu()
85
 
 
1
  from __future__ import annotations
2
 
3
  import os
4
+ import shutil
5
  import subprocess
6
  import sys
7
  import traceback
 
9
 
10
  from huggingface_hub import HfApi
11
 
12
+ from .common import (
13
+ APP_ROOT,
14
+ ARTIFACT_ROOT,
15
+ DATASET_ROOT,
16
+ STATUS_ROOT,
17
+ ensure_dirs,
18
+ fail,
19
+ log_event,
20
+ update_status,
21
+ wait_for_gpu,
22
+ )
23
 
24
 
25
  STAGES = [
 
32
  ("merge_export", "trainer.merge_and_export"),
33
  ]
34
 
35
+ PREPARED_DATASET_ROOT = APP_ROOT / "prepared_dataset"
36
+ PREPARED_DATASET_FILES = (
37
+ "train.jsonl",
38
+ "validation.jsonl",
39
+ "test.jsonl",
40
+ "manifest.json",
41
+ "validation_report.json",
42
+ )
43
+
44
 
45
  def run_module(name: str, extra_env: dict[str, str] | None = None) -> None:
46
  env = os.environ.copy()
 
48
  subprocess.run([sys.executable, "-m", name], check=True, env=env)
49
 
50
 
51
+ def stage_prepared_dataset() -> bool:
52
+ if not PREPARED_DATASET_ROOT.is_dir():
53
+ return False
54
+ missing = [name for name in PREPARED_DATASET_FILES if not (PREPARED_DATASET_ROOT / name).is_file()]
55
+ if missing:
56
+ raise RuntimeError(f"Bundled prepared dataset is incomplete: {', '.join(missing)}")
57
+ update_status("stage_dataset", "Staging the bundled, locally validated SFT dataset")
58
+ DATASET_ROOT.mkdir(parents=True, exist_ok=True)
59
+ for name in PREPARED_DATASET_FILES:
60
+ shutil.copy2(PREPARED_DATASET_ROOT / name, DATASET_ROOT / name)
61
+ log_event("prepared_dataset_staged", files=list(PREPARED_DATASET_FILES))
62
+ return True
63
+
64
+
65
  def upload_artifacts() -> str:
66
  token = os.environ.get("TRAINING_HF_TOKEN")
67
  repo_id = os.environ.get("OUTPUT_MODEL_REPO", "iteratehack/sam-qwen3-1.7b-mountain")
 
112
  lock.write_text(str(os.getpid()), encoding="utf-8")
113
  try:
114
  update_status("starting", "Pipeline started")
115
+ if not stage_prepared_dataset():
116
+ run_module("trainer.download_sources")
117
+ run_module("trainer.build_dataset")
118
  run_module("trainer.validate_dataset")
119
  wait_for_gpu()
120