Spaces:
Running
Running
Commit ·
fef7b21
1
Parent(s): fcd1eb1
- .claude/settings.local.json +0 -17
- .gitignore +2 -1
- precompute_example.py +6 -3
- tests/golden/README.md +4 -4
.claude/settings.local.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"permissions": {
|
| 3 |
-
"allow": [
|
| 4 |
-
"Bash(git init:*)",
|
| 5 |
-
"Bash(git add:*)",
|
| 6 |
-
"Bash(git remote add:*)",
|
| 7 |
-
"Bash(git push:*)",
|
| 8 |
-
"Bash(git branch:*)",
|
| 9 |
-
"Bash(git commit -m \"$\\(cat <<''EOF''\nFix Gradio compatibility for HuggingFace Spaces\n\n- Upgrade gradio to >=5.0.0 to fix API schema bug\n- Add server_name and server_port to demo.launch\\(\\)\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
|
| 10 |
-
"Bash(git commit:*)",
|
| 11 |
-
"Bash(git reset:*)",
|
| 12 |
-
"Bash(and top-10 predictions\" to better reflect what users see in the tooltip.\nAlso updated color legend to match the swapped model positions.\n\nCo-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
|
| 13 |
-
"Bash(git fetch:*)",
|
| 14 |
-
"Bash(git pull:*)"
|
| 15 |
-
]
|
| 16 |
-
}
|
| 17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.gitignore
CHANGED
|
@@ -29,4 +29,5 @@ flagged/
|
|
| 29 |
# Test artifacts
|
| 30 |
tests/_out/
|
| 31 |
|
| 32 |
-
.history/
|
|
|
|
|
|
| 29 |
# Test artifacts
|
| 30 |
tests/_out/
|
| 31 |
|
| 32 |
+
.history/
|
| 33 |
+
.claude/settings.local.json
|
precompute_example.py
CHANGED
|
@@ -25,7 +25,10 @@ PRECOMPUTED_DIR = SCRIPT_DIR / "precomputed"
|
|
| 25 |
QWEN_MODEL_ID = "Qwen/Qwen3-1.7B-Base"
|
| 26 |
RWKV_MODEL_FILENAME = "rwkv7-g1j-1.5b-20260831-ctx16384.pth"
|
| 27 |
RWKV_MODEL_DISPLAY_NAME = "RWKV7-G1J-1.5B"
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
# Detect device
|
| 31 |
# DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
|
@@ -37,7 +40,7 @@ def resolve_rwkv_model_path():
|
|
| 37 |
"""Resolve RWKV7 model path, preferring local absolute path."""
|
| 38 |
from huggingface_hub import hf_hub_download
|
| 39 |
|
| 40 |
-
if RWKV_MODEL_PATH.exists():
|
| 41 |
return str(RWKV_MODEL_PATH)
|
| 42 |
|
| 43 |
model_path = MODELS_DIR / RWKV_MODEL_FILENAME
|
|
@@ -115,7 +118,7 @@ def precompute_example():
|
|
| 115 |
print(f"Example text length: {len(example_text)} characters")
|
| 116 |
|
| 117 |
# Download and load models
|
| 118 |
-
print(f"Resolving RWKV model path (prefer local: {RWKV_MODEL_PATH})...")
|
| 119 |
rwkv_model_path = resolve_rwkv_model_path()
|
| 120 |
|
| 121 |
print("Loading Qwen3-1.7B-Base...")
|
|
|
|
| 25 |
QWEN_MODEL_ID = "Qwen/Qwen3-1.7B-Base"
|
| 26 |
RWKV_MODEL_FILENAME = "rwkv7-g1j-1.5b-20260831-ctx16384.pth"
|
| 27 |
RWKV_MODEL_DISPLAY_NAME = "RWKV7-G1J-1.5B"
|
| 28 |
+
# Optional local checkpoint path. Set RWKV_MODEL_PATH when running locally;
|
| 29 |
+
# leave it unset to download the checkpoint from Hugging Face.
|
| 30 |
+
_rwkv_model_path_env = os.getenv("RWKV_MODEL_PATH")
|
| 31 |
+
RWKV_MODEL_PATH = Path(_rwkv_model_path_env) if _rwkv_model_path_env else None
|
| 32 |
|
| 33 |
# Detect device
|
| 34 |
# DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 40 |
"""Resolve RWKV7 model path, preferring local absolute path."""
|
| 41 |
from huggingface_hub import hf_hub_download
|
| 42 |
|
| 43 |
+
if RWKV_MODEL_PATH is not None and RWKV_MODEL_PATH.exists():
|
| 44 |
return str(RWKV_MODEL_PATH)
|
| 45 |
|
| 46 |
model_path = MODELS_DIR / RWKV_MODEL_FILENAME
|
|
|
|
| 118 |
print(f"Example text length: {len(example_text)} characters")
|
| 119 |
|
| 120 |
# Download and load models
|
| 121 |
+
print(f"Resolving RWKV model path (prefer local: {RWKV_MODEL_PATH or 'none'})...")
|
| 122 |
rwkv_model_path = resolve_rwkv_model_path()
|
| 123 |
|
| 124 |
print("Loading Qwen3-1.7B-Base...")
|
tests/golden/README.md
CHANGED
|
@@ -9,13 +9,13 @@ Suggested naming:
|
|
| 9 |
Keep these files in sync with `tests/samples/`.
|
| 10 |
|
| 11 |
Generate snapshots with:
|
| 12 |
-
`
|
| 13 |
|
| 14 |
Generate a candidate snapshot:
|
| 15 |
-
`
|
| 16 |
|
| 17 |
Compare snapshots:
|
| 18 |
-
`
|
| 19 |
|
| 20 |
Compare HTML output:
|
| 21 |
-
`
|
|
|
|
| 9 |
Keep these files in sync with `tests/samples/`.
|
| 10 |
|
| 11 |
Generate snapshots with:
|
| 12 |
+
`python tests/generate_snapshots.py --out tests/golden`
|
| 13 |
|
| 14 |
Generate a candidate snapshot:
|
| 15 |
+
`python tests/generate_snapshots.py --out tests/_out`
|
| 16 |
|
| 17 |
Compare snapshots:
|
| 18 |
+
`python tests/compare_snapshots.py --baseline tests/golden/stress.render_model.json --candidate tests/_out/stress.render_model.json`
|
| 19 |
|
| 20 |
Compare HTML output:
|
| 21 |
+
`python tests/compare_html.py --baseline tests/golden/stress.output.html --candidate tests/_out/stress.output.html`
|