File size: 1,774 Bytes
0310320
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Benchmark Client

CLI client for interacting with the Transformers.js benchmark server.

## Installation

```bash
npm install
```

## Usage

The client provides commands to submit benchmarks, check their status, and view results.

From the client directory:
```bash
npm run cli -- <command> [options]
```

Or from the root directory:
```bash
npm run cli --prefix client -- <command> [options]
```

### Submit a Benchmark

```bash
npm run cli -- submit <modelId> <task> [options]
```

**Options:**
- `--platform <node|web>` - Platform to run on (default: node)
- `--mode <warm|cold>` - Cache mode (default: warm)
- `--repeats <n>` - Number of times to repeat (default: 3)
- `--batch-size <n>` - Batch size for inference (default: 1)
- `--dtype <type>` - Data type (fp32, fp16, q8, etc.)
- `--device <device>` - Device for web platform (default: webgpu)
- `--browser <chromium|firefox|webkit>` - Browser for web (default: chromium)
- `--headed` - Run browser in headed mode
- `--wait` - Wait for completion

**Examples:**

```bash
# Submit a Node.js benchmark
npm run cli -- submit Xenova/all-MiniLM-L6-v2 feature-extraction --platform node --repeats 5 --wait

# Submit a web benchmark with WebGPU
npm run cli -- submit Xenova/distilbert-base-uncased fill-mask --platform web --device webgpu --headed

# Submit with specific dtype
npm run cli -- submit Xenova/all-MiniLM-L6-v2 feature-extraction --dtype fp16 --batch-size 4
```

### Get Benchmark Result

```bash
npm run cli -- get <benchmark-id>
```

### List All Benchmarks

```bash
npm run cli -- list
```

### Check Queue Status

```bash
npm run cli -- queue
```

## Configuration

Set the server URL via environment variable:

```bash
export BENCH_SERVER_URL=http://localhost:3000
```

Default: `http://localhost:3000`