Spaces:
Running
Running
Test think prefill with pinned SFT epoch 3 revision
Browse files- Dockerfile +1 -0
- README.md +12 -8
- app.py +7 -13
Dockerfile
CHANGED
|
@@ -16,6 +16,7 @@ ENV HOME=/home/user \
|
|
| 16 |
PATH=/opt/venv/bin:$PATH \
|
| 17 |
MODEL_NAME=tr-hash-moe-200m \
|
| 18 |
MODEL_REPO=AETHORIA-AI/TR-HASH-MoE-200M-160B-SFT \
|
|
|
|
| 19 |
CONTEXT_COMPACT_TOKENS=1024 \
|
| 20 |
PORT=7860
|
| 21 |
|
|
|
|
| 16 |
PATH=/opt/venv/bin:$PATH \
|
| 17 |
MODEL_NAME=tr-hash-moe-200m \
|
| 18 |
MODEL_REPO=AETHORIA-AI/TR-HASH-MoE-200M-160B-SFT \
|
| 19 |
+
MODEL_REVISION=e5a599feda17ce9ffa8a0d094fd591b06a4d16f5 \
|
| 20 |
CONTEXT_COMPACT_TOKENS=1024 \
|
| 21 |
PORT=7860
|
| 22 |
|
README.md
CHANGED
|
@@ -6,27 +6,31 @@ colorTo: green
|
|
| 6 |
sdk: docker
|
| 7 |
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
-
license:
|
| 10 |
models:
|
| 11 |
- AETHORIA-AI/TR-HASH-MoE-200M-160B-SFT
|
| 12 |
---
|
| 13 |
|
| 14 |
# TR-Hash Tiny · TR-HASH MoE 200M Full SFT
|
| 15 |
|
| 16 |
-
OpenAI-compatible chat API serving the PIQA-selected epoch-
|
| 17 |
[`AETHORIA-AI/TR-HASH-MoE-200M-160B-SFT`](https://huggingface.co/AETHORIA-AI/TR-HASH-MoE-200M-160B-SFT)
|
| 18 |
with [`Complexity-ML/TR-Hash-i64`](https://github.com/Complexity-ML/TR-Hash-i64).
|
| 19 |
|
| 20 |
This is a full-parameter SFT, not a LoRA adapter. All 201.2M parameters were
|
| 21 |
-
trained for three epochs on the audited
|
| 22 |
-
**68.
|
| 23 |
-
1,838-example validation set.
|
| 24 |
|
| 25 |
The launcher intentionally downloads only the release files at the model-repo
|
| 26 |
root. The three large resumable `step_*` training folders are excluded. The
|
| 27 |
bundled `chat_template.jinja` and tokenizer are loaded beside the single root
|
| 28 |
`model.safetensors`.
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
```bash
|
| 31 |
curl https://pacific-i64-tr-hash-tiny.hf.space/v1/chat/completions \
|
| 32 |
-H "Content-Type: application/json" \
|
|
@@ -34,9 +38,9 @@ curl https://pacific-i64-tr-hash-tiny.hf.space/v1/chat/completions \
|
|
| 34 |
"model": "tr-hash-moe-200m",
|
| 35 |
"messages": [{"role": "user", "content": "Explain why 17 × 23 − 14 equals 377."}],
|
| 36 |
"max_tokens": 1024,
|
| 37 |
-
"temperature": 0.
|
| 38 |
-
"top_k":
|
| 39 |
-
"top_p": 0.
|
| 40 |
"repetition_penalty": 1.1,
|
| 41 |
"stream": false
|
| 42 |
}'
|
|
|
|
| 6 |
sdk: docker
|
| 7 |
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
+
license: apache-2.0
|
| 10 |
models:
|
| 11 |
- AETHORIA-AI/TR-HASH-MoE-200M-160B-SFT
|
| 12 |
---
|
| 13 |
|
| 14 |
# TR-Hash Tiny · TR-HASH MoE 200M Full SFT
|
| 15 |
|
| 16 |
+
OpenAI-compatible chat API serving the PIQA-selected epoch-3 root weights from
|
| 17 |
[`AETHORIA-AI/TR-HASH-MoE-200M-160B-SFT`](https://huggingface.co/AETHORIA-AI/TR-HASH-MoE-200M-160B-SFT)
|
| 18 |
with [`Complexity-ML/TR-Hash-i64`](https://github.com/Complexity-ML/TR-Hash-i64).
|
| 19 |
|
| 20 |
This is a full-parameter SFT, not a LoRA adapter. All 201.2M parameters were
|
| 21 |
+
trained for three epochs on the audited 300K SFT v2 mixture. Epoch 3 scores
|
| 22 |
+
**68.01% PIQA accuracy** and **69.21% length-normalized accuracy** on the full
|
| 23 |
+
1,838-example validation set in the MLX FP16 cross-check.
|
| 24 |
|
| 25 |
The launcher intentionally downloads only the release files at the model-repo
|
| 26 |
root. The three large resumable `step_*` training folders are excluded. The
|
| 27 |
bundled `chat_template.jinja` and tokenizer are loaded beside the single root
|
| 28 |
`model.safetensors`.
|
| 29 |
|
| 30 |
+
This experimental deployment pre-fills `<think>` in the assistant generation
|
| 31 |
+
prompt. The model is expected to close it with `</think>` and then emit a
|
| 32 |
+
`<final>` answer, but this behavior is under live evaluation.
|
| 33 |
+
|
| 34 |
```bash
|
| 35 |
curl https://pacific-i64-tr-hash-tiny.hf.space/v1/chat/completions \
|
| 36 |
-H "Content-Type: application/json" \
|
|
|
|
| 38 |
"model": "tr-hash-moe-200m",
|
| 39 |
"messages": [{"role": "user", "content": "Explain why 17 × 23 − 14 equals 377."}],
|
| 40 |
"max_tokens": 1024,
|
| 41 |
+
"temperature": 0.3,
|
| 42 |
+
"top_k": 20,
|
| 43 |
+
"top_p": 0.95,
|
| 44 |
"repetition_penalty": 1.1,
|
| 45 |
"stream": false
|
| 46 |
}'
|
app.py
CHANGED
|
@@ -9,7 +9,6 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
| 9 |
from pathlib import Path
|
| 10 |
|
| 11 |
from huggingface_hub import snapshot_download
|
| 12 |
-
from huggingface_hub.errors import LocalEntryNotFoundError
|
| 13 |
|
| 14 |
|
| 15 |
def _available_cpus() -> int:
|
|
@@ -39,6 +38,7 @@ model_name = os.environ["MODEL_NAME"]
|
|
| 39 |
model_repo = os.environ.get(
|
| 40 |
"MODEL_REPO", "AETHORIA-AI/TR-HASH-MoE-200M-160B-SFT"
|
| 41 |
)
|
|
|
|
| 42 |
model_dir_override = os.environ.get("MODEL_DIR")
|
| 43 |
port = int(os.environ.get("PORT", "7860"))
|
| 44 |
MODEL_FILES = [
|
|
@@ -82,21 +82,15 @@ def _resolve_checkpoint() -> str:
|
|
| 82 |
thread = threading.Thread(target=server.serve_forever, daemon=True)
|
| 83 |
thread.start()
|
| 84 |
print(
|
| 85 |
-
f"Resolving {model_repo}
|
| 86 |
flush=True,
|
| 87 |
)
|
| 88 |
try:
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
)
|
| 95 |
-
except LocalEntryNotFoundError:
|
| 96 |
-
checkpoint_dir = snapshot_download(
|
| 97 |
-
repo_id=model_repo,
|
| 98 |
-
allow_patterns=MODEL_FILES,
|
| 99 |
-
)
|
| 100 |
finally:
|
| 101 |
server.shutdown()
|
| 102 |
server.server_close()
|
|
|
|
| 9 |
from pathlib import Path
|
| 10 |
|
| 11 |
from huggingface_hub import snapshot_download
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
def _available_cpus() -> int:
|
|
|
|
| 38 |
model_repo = os.environ.get(
|
| 39 |
"MODEL_REPO", "AETHORIA-AI/TR-HASH-MoE-200M-160B-SFT"
|
| 40 |
)
|
| 41 |
+
model_revision = os.environ.get("MODEL_REVISION") or None
|
| 42 |
model_dir_override = os.environ.get("MODEL_DIR")
|
| 43 |
port = int(os.environ.get("PORT", "7860"))
|
| 44 |
MODEL_FILES = [
|
|
|
|
| 82 |
thread = threading.Thread(target=server.serve_forever, daemon=True)
|
| 83 |
thread.start()
|
| 84 |
print(
|
| 85 |
+
f"Resolving {model_repo} at revision {model_revision or 'main'}.",
|
| 86 |
flush=True,
|
| 87 |
)
|
| 88 |
try:
|
| 89 |
+
checkpoint_dir = snapshot_download(
|
| 90 |
+
repo_id=model_repo,
|
| 91 |
+
revision=model_revision,
|
| 92 |
+
allow_patterns=MODEL_FILES,
|
| 93 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
finally:
|
| 95 |
server.shutdown()
|
| 96 |
server.server_close()
|