Spaces:
Running on Zero
Running on Zero
Connect Qwen3 Transformers inference and quota-bounded scenario evaluation
Browse filesFiles changed (5)
- README.md+5-1
- app.py+30-1
- harnesslab_bundle.zip+2-2
- manifest.json+13-3
- requirements.txt+3
44 unmodified lines45464748484950515253545544 unmodified lines- `HARNESS_TEMPERATURE=0`, `HARNESS_MAX_TOKENS=2048`, `HARNESS_SEED=42`
Space의 localhost는 사용자의 PC가 아닙니다. 외부 추론 서비스 비용은 활성화할 때 별도로 확인하세요.이번 프로토타입은 Hugging Face GPU 모델 추론 백엔드를 추가하지 않았습니다.`실제 모델` 버튼 또는 `/gradio`에서 Qwen/Qwen3-4B-Instruct-2507을 직접 실행할 수 있습니다.1회 실행은 S01~S05 중 선택한 시나리오 1개이며 최대 120초 ZeroGPU 작업을 요청합니다.temperature 0, seed 42, 최대 출력 512토큰, 최대 6단계입니다. 기록 데이터와 별도로실행 결과와 Trace JSON을 제공합니다. 모델 가중치는 시작 시 준비하고 GPU 시간은실행 버튼을 누를 때만 요청합니다. 실제 모델 실행에는 무료 GPU 쿼터가 사용됩니다.
## 데이터
33 unmodified lines34353637383940414243444546474849505152535455565758596061626312 unmodified lines7677785579808182838485868733 unmodified lines import spaces import uvicorn from space_app import app as workspace from transformers import AutoModelForCausalLM, AutoTokenizer import torch import tempfile from uuid import uuid4 from adapters.transformers_local import TransformersLocalAdapter from harness.hf_evaluation import evaluate_case
model_id = "Qwen/Qwen3-4B-Instruct-2507" tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=False) model = AutoModelForCausalLM.from_pretrained( model_id, torch_dtype=torch.float16, low_cpu_mem_usage=True, trust_remote_code=False, ).eval().to("cuda")
@spaces.GPU(duration=120) def run_model(case_id: str) -> tuple[dict, str]: adapter = TransformersLocalAdapter(model_id=model_id, model=model, tokenizer=tokenizer) path = Path(tempfile.gettempdir()) / f"harnesslab-hf-{uuid4()}.json" batch = evaluate_case(adapter, case_id, model_id, getattr(model.config, "_commit_hash", None), root, path) from space_app import store_report report_id = store_report(batch, "real_live") result = batch.summary() result["workspace_report"] = f"/?report={report_id}" result["failure_reason"] = batch.cases[0].report.evaluation.failure_reason return result, str(path)
@spaces.GPU(duration=10) def gpu_environment_check() -> dict[str, str | float]:12 unmodified lines "purpose": "GPU environment diagnostic; not a model performance benchmark"}
with gr.Blocks(title="HarnessLab") as info: gr.Markdown("# HarnessLab\n[평가 워크스페이스 열기](/)\n\n기존 평가 엔진을 실행하는 프로토타입입니다. GPU 추론은 포함하지 않습니다.") gr.Markdown("# HarnessLab — 실제 모델 평가\n[평가 워크스페이스 열기](/)\n\nQwen3-4B-Instruct-2507을 이 Space에서 실행합니다. API 키나 로컬 PC가 필요 없습니다. 1회 실행은 시나리오 1개이며 최대 120초의 ZeroGPU 작업을 요청합니다. 무료 쿼터를 사용합니다.") scenario = gr.Dropdown(["S01", "S02", "S03", "S04", "S05"], value="S01", label="평가 시나리오") execute = gr.Button("실제 모델 평가 실행 — ZeroGPU 사용", variant="primary") summary = gr.JSON(label="실제 실행 결과") artifact = gr.File(label="평가 Trace JSON 다운로드") execute.click(run_model, inputs=[scenario], outputs=[summary, artifact], api_name="evaluate_model", concurrency_limit=1) gr.Markdown("## 선택: GPU 환경 확인\n버튼을 누를 때만 ZeroGPU 쿼터를 사용합니다(요청 최대 10초). Mock 평가와 기록 조회에는 필요하지 않습니다.") diagnostic = gr.Button("GPU 환경 확인 — ZeroGPU 쿼터 사용") gpu_result = gr.JSON(label="환경 확인 결과 — 모델 성능 지표가 아닙니다")12323version https://git-lfs.github.com/spec/v1oid sha256:1669bfe33c30b83bb85b5ccf3eb71e6153d130f73fc12bf3da8480d017162142size 53363oid sha256:cdca6022e818220ad5c9ef7fe0691e3a2e64a10bb42136c86c873df602c452desize 56927123345620 unmodified lines272829303132333435363744 unmodified lines828384858687888990919241 unmodified lines134135136127128137138139140141{
"release": "HarnessLab Gradio Space Prototype",
"bundle_sha256": "1669bfe33c30b83bb85b5ccf3eb71e6153d130f73fc12bf3da8480d017162142",
"bundle_sha256": "cdca6022e818220ad5c9ef7fe0691e3a2e64a10bb42136c86c873df602c452de",
"files": [
{
"path": "harness/__init__.py",20 unmodified lines "bytes": 989,
"sha256": "1b3fb1917c4d43aa40a6e3161f3fab6a7489859aa81c95c7c7bbb20444ebdab8"
},
{
"path": "harness/hf_evaluation.py",
"bytes": 1655,
"sha256": "95ffffc5613a34c526ed1629fddb8b78d8fae27c3a3b00e84070142294cff886"
},
{
"path": "harness/local_tools.py",
"bytes": 730,44 unmodified lines "bytes": 1825,
"sha256": "93a827a73be032f6fd248c6efeee32bd610284ec86b32ec11b2b2e1c5b683b07"
},
{
"path": "adapters/transformers_local.py",
"bytes": 7154,
"sha256": "4c1cd6e7193e08bd4b6b69025072726359328a957a49c56a00d12f88d64afac2"
},
{
"path": "data/scenarios/01_save_note.json",
"bytes": 468,41 unmodified lines },
{
"path": "web/index.html",
"bytes": 18933,
"sha256": "4f46e32ad49c2a98acdec63d4e94af59b3a7861ab95373cc634926f04990942d"
"bytes": 19248,
"sha256": "34da8cca1df287377b39e473d4eb1d8ffd7a123b6207b45a23fbd5e67ada9837"
},
{
"path": "data/reference_runs/ollama_local_02/smoke.json",3 unmodified lines4567893 unmodified lineshttpx>=0.27,<1
fastapi>=0.115,<1
uvicorn>=0.30,<1
transformers>=4.51,<5
accelerate>=1,<2
safetensors>=0.4README.md+5-1
app.py+30-1
harnesslab_bundle.zip+2-2
manifest.json+13-3
requirements.txt+3