Getting Started
Relevant source files
The following files were used as context for generating this wiki page:
The ONNX-Station (also referred to as OPTIMUM.WORKBENCH) is a specialized development environment designed for configuring, exporting, and benchmarking machine learning models using the Hugging Face Optimum library and ONNX Runtime. The system provides a graphical interface to bridge the gap between high-level model selection and low-level ONNX optimization parameters, allowing developers to generate optimum-cli commands and validate model performance within a browser-based sandbox.
Sources: src/WorkbenchContext.tsx:1-40, src/components/CenterCanvas.tsx:18-25
System Architecture
The application is built as a React-based web interface powered by Vite. It utilizes a centralized state management pattern via the WorkbenchProvider to synchronize configurations across the sidebar, main canvas, and console components.
The diagram shows the component hierarchy and the flow of configuration data from the Provider to the functional UI modules.
Sources: src/App.tsx:15-30, src/WorkbenchContext.tsx:95-105
Local Development Setup
To run the ONNX-Station locally, ensure you have Node.js installed. The project uses Vite for its build pipeline and development server.
- Installation: Install the required dependencies using the package manager.
npm install - Configuration: If using Gemini-related features, set the
GEMINI_API_KEYin.env.local. - Execution: Launch the development server.
The application will be accessible atnpm run devhttp://localhost:3000.
Sources: README.md:14-22, package.json:6-10
Core Workflow
The "Getting Started" workflow involves three primary phases: Model Definition, Configuration Optimization, and Performance Validation.
1. Model Definition
Users specify the model source, which can be a Hugging Face Hub ID (e.g., openai/whisper-base) or a local ONNX file path. The system then requires a Modality (Audio, Text, or Vision) and a corresponding Task Map to guide the Optimum configuration class.
| Configuration | Description | Sources |
|---|---|---|
modelSourceType | Toggles between hub and local pathing. | src/components/Sidebar.tsx:106-125 |
modality | Sets the input pipeline (e.g., Text Processors). | src/components/Sidebar.tsx:210-225 |
task | Guides exact model structural inputs/outputs. | src/components/Sidebar.tsx:236-248 |
2. Export Configuration
This phase involves setting the ONNX IR parameters and hardware target specifications. This includes the Opset version, device target (CPU or CUDA), and precision overrides (FP32, FP16, or BF16).
The sequence diagram illustrates how UI updates trigger the dynamic generation of the CLI command preview.
Sources: src/WorkbenchContext.tsx:160-195, src/components/CenterCanvas.tsx:75-90
3. Benchmarking & Validation
Once configured, the workbench can initiate a local benchmark using onnxruntime-web. This process generates synthetic inputs based on the selected modality and measures latencies and throughput.
- Warmup: The system runs 3 initial iterations to stabilize the runtime environment.
- Timed Runs: 20 iterations are performed to calculate Mean, P50, and P95 latencies.
- Synthetic Input Generation: Automatically creates tensors (e.g.,
input_idsfor text orpixel_valuesfor vision) based on session input names.
Sources: src/lib/benchmark.ts:180-220, src/lib/benchmark.ts:25-80
System Presets
For a quick start, the workbench includes pre-defined optimization profiles that match common deployment targets.
| Profile Name | Opset | Device | Dtype | Optimization |
|---|---|---|---|---|
| WebGPU fp16 Target | 17 | cuda | fp16 | O3 |
| CPU fp32 Portable | 14 | cpu | fp32 | O1 |
| CUDA bf16 Heavy | 17 | cuda | bf16 | O4 |
| Low-Memory Raw Debug | 14 | cpu | fp32 | none |
Sources: src/WorkbenchContext.tsx:7-39
Summary
The ONNX-Station provides a comprehensive interface for model optimization. By selecting a model, defining the task modality, and applying hardware-specific configurations, developers can export validated ONNX artifacts ready for production deployment. The integrated benchmarking suite ensures that performance characteristics are understood before the model leaves the development environment.
Sources: src/WorkbenchContext.tsx:260-280, src/components/CenterCanvas.tsx:190-210