Name / README.md
Username-IV
fixed the model card
2ce23d3
|
Raw History Blame Contribute Delete
7.98 kB

A newer version of the Gradio SDK is available: 6.32.0

Upgrade
metadata
title: RemeDi Test Bench
emoji: 🔬
colorFrom: green
colorTo: blue
sdk: gradio
sdk_version: 5.49.1
python_version: '3.12'
app_file: app.py
pinned: false
models:
  - maple-research-lab/RemeDi-Instruct
  - GSAI-ML/LLaDA-8B-Instruct
suggested_hardware: zero-a10g
startup_duration_timeout: 1h

RemeDi Test Bench

A ZeroGPU Gradio test Space for maple-research-lab/RemeDi-Instruct. Uses the official custom dual-stream architecture, rather than trying to run this diffusion model through autoregressive generate().

Deploy

  1. Create a Hugging Face Space with the Gradio SDK and select ZeroGPU hardware in Settings. The README hardware suggestion does not provision hardware; the UI's current ZeroGPU option is authoritative.
  2. Extract this ZIP and upload its contents into the Space repository root. app.py, README.md and requirements.txt must be at the root, alongside the remedi/ directory. Do not upload the ZIP itself as the app.
  3. Let the first build download the checkpoint. The source checkpoint is approximately 35.8 GB; runtime weights use BF16 (roughly 18 GB plus working memory). Ensure enough disk and CPU RAM for downloading and loading shards. ZeroGPU hosting eligibility and usage quotas depend on your Hugging Face account.
  4. Start with 128 tokens, block size 32, 16 steps, Official raw logits. Run the three default suite cases, inspect the answers and download their JSON report. These smoke checks are deliberately small and do not measure benchmark accuracy.

Public model downloads normally need no token. If Hub authentication is required, add HF_TOKEN as a Space secret, never as a committed file. No paid inference endpoint, API key from another provider, or external inference service is used.

Alternatively, from your cloned Space repository, copy the extracted files into it and commit/push normally. No weights are included in this ZIP; they download from pinned Hub revisions at startup.

Features

  • Single-turn prompts, optional system instruction and eight selectable example tasks.
  • Exact new-token cap (1–256), block size 16/32/64, 1–64 denoising steps, and bounded work per request.
  • Official raw-logit token ranking; two explicit experimental alternatives: learned policy-head confidence and normalised token probability.
  • Per-step block text/token IDs, retained token counts, and remasking counts.
  • Response timing, forward counts, output tokens, finish reason and aggregate throughput.
  • Eight smoke cases across arithmetic, multi-step reasoning, instructions, JSON, extraction, logic, code and explanations. Six have transparent strict graders; two require manual review. Generated Python is never executed.
  • Sequential suite results and downloadable JSON with prompts, settings, pinned revisions and runtime metadata.
  • Fresh KV cache per generation, serialized GPU work, queue bounds and expiring Gradio report files.

Method and corrections

Official source: https://github.com/maple-research-lab/RemeDi, commit 2e1b19d34db09e345898f6c5b6ed60418659821a. The remedi/ Python files are vendored unmodified. See THIRD_PARTY_NOTICES.md.

The new engine.py follows the released block diffusion loop, with these documented changes:

  • Uses the model's custom DynamicCache, which provides .layers; the example imports Transformers' incompatible cache class.
  • Loads RemeDi-Instruct, explicitly, instead of the example's RemeDi-RL default.
  • Uses the pinned base LLaDA-8B-Instruct tokenizer because the target checkpoint contains no tokenizer files. Special IDs and vocabulary size are checked at startup.
  • Loads the vendored config/model directly; the checkpoint's auto_map names Python files absent from the checkpoint repository. Missing, unexpected or mismatched weight keys fail startup.
  • Detects EOS only in generated tokens, stops after the fully denoised block containing EOS, and excludes EOS plus following tokens from the answer. The original script never updates its EOS stopping flag and scans the prompt for EOS.
  • Handles non-multiple output limits with a short final block and excludes the mask sentinel from generated candidates.
  • Removes unused batching/attention-mask code and unsupported example call arguments. Requests are batch size one with no padding.
  • Replaces the model's activation-checkpoint wrapper with a direct function call during inference; architecture and weights are unchanged.
  • Imports spaces before model code and places BF16 weights on CUDA at module startup, following ZeroGPU's emulated startup placement guidance. All real forwards occur in a 120-second @spaces.GPU lease. No torch.compile, bitsandbytes or flash-attention build is required.

The published example selects positions using raw candidate logits, not its separate confidences output. This is the default for fidelity to released code. The learned-confidence mode uses that separate output, but its calibration/direction and correspondence to the paper are not established here. It is an experiment, not a claimed reproduction. Token probability is another explicit ablation.

Tokens can be remasked within the current block, including ones kept in earlier steps. A completed block is appended to the cache and cannot subsequently be revised. Transfer counts follow the original cumulative schedule; when steps exceed block length, some initial steps retain no tokens. Those settings waste compute but remain well-defined.

Token proposals are greedy argmax. The recorded seed is not a temperature control and does not induce output variety. GPU kernels can still be nondeterministic. Timing measures the decorated generation loop, excludes queueing/download/startup, and includes trace capture when enabled. Throughput is an aggregate, not a streaming-token latency measurement.

Tests and validation

python -m pip install -r requirements-dev.txt
python -m pytest -q
# Optional: live metadata + tokenizer checks, without loading weights or CUDA
python preflight.py

The tests run offline after dependency installation; no 9B weights or GPU required. They cover the scheduler, bounds, error paths, prompt validation, cache isolation, EOS, final partial blocks, actual remasking, all ranking modes, trace/report serialization, graders, UI construction, real tiny-width 32-layer dual-stream forwards and cache updates, and save/reload with low-memory BF16 loading. Tiny random models verify mechanics, not response quality.

See TEST_REPORT.md for what was executed during packaging and what still requires a hosted GPU run. Dependency versions are pinned, including the tested spaces release. Hugging Face supplies Gradio from this README's sdk_version.

Hosted acceptance check

After deployment, confirm Environment shows strict loading and special IDs passed. Generate a short answer, then try an output cap of 35 with a 16-token block. Run one case with each policy. Confirm traces finish without mask tokens, reports download, a second prompt starts with a fresh context, and the suite updates one case at a time. Compare quality manually; a strict-format smoke failure can be a model failure rather than an application bug. Run longer requests only after short ones succeed.

If startup fails, inspect build/runtime logs: insufficient disk/RAM, network access, unavailable ZeroGPU hardware, and quota exhaustion cannot be fixed by a ZIP setting. If a request times out, reduce steps/output tokens. Stop cancels queued work and suite continuation; it may not interrupt an active forward immediately. Reports are temporary and cleared by Gradio's cache cleanup; download any results you need.

Sources