luquiT4 commited on
Commit
140769d
·
verified ·
1 Parent(s): 377005e

Upload 3 files

Browse files
assets/index-B-RSiTDO.js ADDED
The diff for this file is too large to render. See raw diff
 
assets/index-tn0RQdqM.css ADDED
File without changes
index.html CHANGED
@@ -1,65 +1,94 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Transformers.js | WebGPU Benchmark</title>
8
- <script type="module" crossorigin src="/assets/index-D9dUKbnn.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-BZcCtzqA.css">
10
- </head>
11
-
12
- <body>
13
- <h1>
14
- <a href="http://github.com/xenova/transformers.js" target="_blank">🤗 Transformers.js</a> WebGPU Benchmark
15
- </h1>
16
- <p>
17
- This benchmark measures the execution time of BERT-based embedding models
18
- using the WASM and WebGPU execution providers across different batch sizes.
19
- </p>
20
- <div id="chart-container">
21
- <canvas id="chart"></canvas>
22
- </div>
23
- <div>
24
- <button id="start" disabled>Start Benchmark</button>
25
- <button id="stop" disabled>Stop Benchmark</button>
26
- </div>
27
- <label id="status"></label>
28
- <details open>
29
- <summary>Options</summary>
30
- <div>
31
- <input class="tests" type="checkbox" value="WASM (int8)" data-color="33,150,243" data-device="wasm"
32
- data-dtype="int8"> WASM (int8)<br />
33
- <input class="tests" type="checkbox" value="WASM (fp16)" data-color="63,81,181" data-device="wasm"
34
- data-dtype="fp16"> WASM (fp16)<br />
35
- <input class="tests" type="checkbox" value="WASM (fp32)" data-color="46,204,113" data-device="wasm"
36
- data-dtype="fp32" checked> WASM (fp32)<br />
37
- <!-- <input class="tests" type="checkbox" value="WebGPU (int8)" data-color="233,30,99" data-device="webgpu"
38
- data-dtype="int8"> WebGPU (int8)<br /> -->
39
- <input class="tests" type="checkbox" value="WebGPU (fp16)" data-color="255,193,7" data-device="webgpu"
40
- data-dtype="fp16"> WebGPU (fp16)<br />
41
- <input class="tests" type="checkbox" value="WebGPU (fp32)" data-color="0,150,136" data-device="webgpu"
42
- data-dtype="fp32" checked> WebGPU (fp32)<br />
43
- </div>
44
- <hr />
45
- <div>
46
- <label>Model ID</label>
47
- <input id="model-id" value="Xenova/all-MiniLM-L6-v2" />
48
- </div>
49
- <div>
50
- <label>Batch sizes</label>
51
- <input id="batch-sizes" value="1, 2, 4, 8, 16, 32" />
52
- </div>
53
- <div>
54
- <label>Sequence length</label>
55
- <input id="sequence-length" type="number" min="1" max="512" value="512" />
56
- </div>
57
- <hr />
58
- <div>
59
- <input id="x-scale" type="checkbox" /> Log scale (x) <br />
60
- <input id="y-scale" type="checkbox" /> Log scale (y) <br />
61
- </div>
62
- </details>
63
- </body>
64
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  </html>
 
1
+ <html lang="en">
2
+ <head>
3
+ <meta charset="UTF-8" />
4
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
+ <title>Embeddings 3D (Plotly) | Transformers.js</title>
6
+ <!-- Tailwind CSS -->
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ body { margin: 0; padding: 0; font-family: 'Inter', sans-serif; background-color: #ffffff; }
10
+ /*
11
+ .observablehq {
12
+ position: relative;
13
+ width: 100%;
14
+ max-width: 1000px;
15
+ margin: 0 auto;
16
+ }
17
+ */
18
+ .legend-swatch {
19
+ width: 0.5rem;
20
+ height: 0.5rem;
21
+ display: inline-block;
22
+ border-radius: 50%;
23
+ margin-right: 0.3rem;
24
+ }
25
+ .legend-item {
26
+ margin-right: 1.5rem;
27
+ font-size: 0.875rem;
28
+ color: #6e6e80;
29
+ display: inline-flex;
30
+ align-items: center;
31
+ }
32
+ .small-copy {
33
+ display: flex;
34
+ justify-content: center;
35
+ flex-wrap: wrap;
36
+ margin-top: 1rem;
37
+ margin-bottom: 2rem;
38
+ }
39
+ /* Keep existing spinner */
40
+ .spinner {
41
+ border: 4px solid rgba(0, 0, 0, 0.1);
42
+ width: 24px;
43
+ height: 24px;
44
+ border-radius: 50%;
45
+ border-left-color: #09f;
46
+ animation: spin 1s ease infinite;
47
+ display: inline-block;
48
+ vertical-align: middle;
49
+ }
50
+ @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
51
+ </style>
52
+ <script type="module" crossorigin src="/assets/index-B-RSiTDO.js"></script>
53
+ <link rel="stylesheet" crossorigin href="/assets/index-tn0RQdqM.css">
54
+ </head>
55
+ <body class="flex flex-col items-center justify-center min-h-screen p-4">
56
+
57
+ <div class="w-full max-w-5xl">
58
+ <!-- Header -->
59
+ <div class="mb-2 text-center">
60
+ <h1 class="text-3xl font-bold text-gray-900">Embeddings: 3D (Plotly)</h1>
61
+ <p class="text-sm text-gray-500 mt-2">Powered by Transformers.js & WebGPU</p>
62
+ </div>
63
+
64
+ <!-- Controls (Adapted) -->
65
+ <div id="controls" class="bg-white p-4 rounded-lg shadow-sm border border-gray-200 mb-6 max-w-2xl mx-auto">
66
+ <div class="mb-4">
67
+ <label for="text-input" class="block text-sm font-medium text-gray-700 mb-1">Enter text to embed (one per line)</label>
68
+ <textarea id="text-input" rows="4" class="w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm" placeholder="King&#10;Queen&#10;Man&#10;Woman&#10;Apple&#10;Banana&#10;Computer&#10;Keyboard"></textarea>
69
+ </div>
70
+ <div class="flex items-center justify-between">
71
+ <button id="generate-btn" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
72
+ <span id="btn-text">Visualize Embeddings</span>
73
+ <div id="loader" class="spinner ml-2" style="display: none;"></div>
74
+ </button>
75
+ <div id="status-msg" class="text-sm text-gray-500">Model loading...</div>
76
+ </div>
77
+
78
+ <div id="progress-container" class="mt-4 hidden">
79
+ <div class="w-full bg-gray-200 rounded-full h-2.5">
80
+ <div id="progress-bar" class="bg-blue-600 h-2.5 rounded-full" style="width: 0%"></div>
81
+ </div>
82
+ <div id="progress-label" class="text-xs text-gray-500 text-center mt-1">0%</div>
83
+ </div>
84
+ </div>
85
+
86
+ <!-- Legend -->
87
+ <div id="legend-container"></div>
88
+
89
+ <!-- Chart -->
90
+ <div id="chart-div" style="min-height: 500px;"></div>
91
+ </div>
92
+
93
+ </body>
94
  </html>