File: aboutInference.html

package info (click to toggle)
firefox 143.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,617,328 kB
  • sloc: cpp: 7,478,492; javascript: 6,417,157; ansic: 3,720,058; python: 1,396,372; xml: 627,523; asm: 438,677; java: 186,156; sh: 63,477; makefile: 19,171; objc: 13,059; perl: 12,983; yacc: 4,583; cs: 3,846; pascal: 3,405; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (299 lines) | stat: -rw-r--r-- 10,411 bytes parent folder | download | duplicates (3)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!doctype html>
<html>
  <head>
    <meta
      http-equiv="Content-Security-Policy"
      content="default-src chrome:;img-src data: blob:; object-src 'none'"
    />
    <meta name="color-scheme" content="light dark" />
    <title data-l10n-id="about-inference-title"></title>
    <link rel="stylesheet" href="chrome://global/content/aboutInference.css" />
    <link rel="localization" href="preview/aboutInference.ftl" />
    <script
      type="module"
      src="chrome://global/content/model-files-view.mjs"
    ></script>
    <script src="chrome://global/content/aboutInference.js"></script>
  </head>
  <body id="body">
    <div id="categories">
      <div
        class="category category-no-icon"
        selected="true"
        id="category-local-inference"
      >
        <span
          class="category-name"
          data-l10n-id="about-inference-category-local-inference"
        ></span>
      </div>
      <div class="category category-no-icon" id="category-http-inference">
        <span
          class="category-name"
          data-l10n-id="about-inference-category-http-inference"
        ></span>
      </div>
      <div class="category category-no-icon" id="category-models-storage">
        <span
          class="category-name"
          data-l10n-id="about-inference-category-models-storage"
        ></span>
      </div>
      <div class="category category-no-icon" id="category-benchmark">
        <span
          class="category-name"
          data-l10n-id="about-inference-category-benchmark"
        ></span>
      </div>
    </div>

    <div class="main-content">
      <div class="header">
        <h1
          id="sectionTitle"
          data-l10n-id="about-inference-header"
          class="header-name"
        ></h1>
        <p>
          <span data-l10n-id="about-inference-description"></span>

          <a
            href="https://firefox-source-docs.mozilla.org/toolkit/components/ml"
            data-l10n-id="about-inference-learn-more"
          ></a>
        </p>
        <moz-message-bar
          type="warning"
          id="warning"
          message=""
        ></moz-message-bar>
      </div>
      <div id="content">
        <!-- local tab -->
        <div id="local-inference" class="tab active">
          <div class="fieldset-container">
            <fieldset>
              <legend>Inference Pad</legend>

              Predefined example:
              <select id="predefined"></select>
              <hr />
              <div class="form-container">
                <div>
                  Pick a Model Hub to use:
                  <span class="tooltip"
                    >ℹ️
                    <span class="tooltiptext">
                      If you want to use Hugging Face, start Firefox with
                      MOZ_ALLOW_EXTERNAL_ML_HUB=1
                    </span>
                  </span>

                  <select id="modelHub">
                    <option value="mozilla">Mozilla</option>
                    <option value="huggingface">Hugging Face</option>
                  </select>
                </div>

                <div>
                  <label for="taskName">Task:</label>
                  <select id="taskName"></select>
                </div>
                <div>
                  <label for="modelId">Model id:</label>
                  <span class="tooltip"
                    >ℹ️
                    <span class="tooltiptext">
                      The model needs to be compatible with Transformers.js
                    </span>
                  </span>

                  <input
                    type="text"
                    id="modelId"
                    value="mozilla/text_summarization"
                  />
                </div>
                <div>
                  <label for="modelRevision">Model Revision:</label>
                  <span class="tooltip"
                    >ℹ️
                    <span class="tooltiptext">
                      This is typically the branch of the model repository.
                    </span>
                  </span>

                  <input type="text" id="modelRevision" value="main" />
                </div>
                <div>
                  <label for="quantization">Quantization:</label>
                  <select id="dtype"></select>
                </div>
                <div>
                  <label for="device">Device:</label>
                  <select id="device">
                    <option value="cpu" selected>cpu</option>
                    <option value="gpu">gpu</option>
                  </select>
                </div>
                <div>
                  <label for="numRuns">Number of runs:</label>
                  <span class="tooltip"
                    >ℹ️
                    <span class="tooltiptext">Number of times to run</span>
                  </span>
                  <input id="numRuns" type="number" min="1" value="1" />
                </div>
                <div>
                  <label for="numThreads">Number of threads:</label>
                  <span class="tooltip"
                    >ℹ️
                    <span class="tooltiptext">1 means no multi-threading</span>
                  </span>
                  <select id="numThreads"></select>
                </div>
                <div>
                  <label for="backend">Backend:</label>
                  <select id="backend"></select>
                </div>
                <div>
                  <label for="timeout">Timeout:</label>
                  <input id="timeout" type="number" min="30" value="30" />
                </div>
                <div>
                  <label for="inferencePad">Input data:</label>
                  <span class="tooltip"
                    >ℹ️
                    <span class="tooltiptext">
                      Keep the JSON valid, with the provided keys.
                    </span>
                  </span>

                  <textarea id="inferencePad"></textarea>
                </div>
                <div>
                  <input
                    type="button"
                    id="inferenceButton"
                    value="Run Inference"
                  />
                </div>
              </div>
            </fieldset>

            <fieldset>
              <legend data-l10n-id="about-inference-processes-title"></legend>
              <div id="statusTableContainer"></div>
              <hr />
              <div id="procInfoTableContainer"></div>
              <h3>Downloads</h3>
              <div id="downloads"></div>
              <h3>Console</h3>
              <textarea readonly id="console"></textarea>
            </fieldset>
          </div>
        </div>

        <!-- http tab -->
        <div id="http-inference" class="tab" hidden="true">
          <div class="fieldset-container">
            <fieldset>
              <legend>HTTP Inference Pad</legend>
              <div class="form-container">
                <div>
                  <label for="http.endpoint">HTTP endpoint:</label>
                  <input
                    id="http.endpoint"
                    type="text"
                    value="http://localhost:8080/v1/chat/completions"
                  />
                </div>
                <div>
                  <label for="http.model">Model:</label>
                  <span class="tooltip"
                    >ℹ️
                    <span class="tooltiptext">
                      Some endpoints require a specific model.
                    </span>
                  </span>
                  <input id="http.model" type="text" />
                </div>
                <div>
                  <label for="http.bearer">Bearer token:</label>
                  <span class="tooltip"
                    >ℹ️
                    <span class="tooltiptext">
                      Some endpoints require a token for access.
                    </span>
                  </span>
                  <input id="http.bearer" type="text" />
                </div>
                <div>
                  <label for="http.prompt">Prompt:</label>
                  <textarea id="http.prompt">
                  Suggest a story from %stories% to read after "%tabTitle%"
                </textarea
                  >
                </div>
                <div>
                  <input
                    id="http.button"
                    type="button"
                    value="Run HTTP Inference"
                  />
                </div>
              </div>
            </fieldset>

            <fieldset>
              <legend>HTTP Inference Data</legend>
              <h3>
                Context
                <input
                  id="http.limit"
                  max="120"
                  min="1"
                  type="range"
                  value="10"
                />
              </h3>
              <div id="http.context"></div>
              <h3>Output</h3>
              <textarea id="http.output" readonly></textarea>
            </fieldset>
          </div>
        </div>

        <!-- model tab -->
        <div id="models-storage" class="tab" hidden="true">
          <model-files-view></model-files-view>
        </div>

        <!-- benchmark -->
        <div id="benchmark" class="tab" hidden="true">
          <div class="fieldset-container">
            <fieldset class="large">
              <legend data-l10n-id="about-inference-benchmark-title"></legend>
              <p data-l10n-id="about-inference-benchmark-description"></p>
              <div id="benchmark">
                <input
                  id="benchmark.button"
                  type="button"
                  data-l10n-id="about-inference-benchmark-button"
                  value="Run Benchmark"
                />
                <label for="benchmark.backend">Backend:</label>
                <select id="benchmark.backend"></select>
                <textarea id="benchmark.output" readonly></textarea>
              </div>
            </fieldset>
          </div>
        </div>
      </div>
    </div>
    <!-- end of content -->
  </body>
</html>