Skip to content

Commit 650f65b

Browse files
authored
Add contribution guideline (#28)
In this PR: - Adds CONTRIBUTING.md file - Clean up the README.md file - Adds the experimental folder for adding new benchmarks by external contributors
1 parent 15dc13f commit 650f65b

20 files changed

+3958
-71
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@
1212
/resources/litert-js/dist/
1313
/resources/litert-js/models/
1414

15+
/resources/experimental/node_modules/
16+
/resources/experimental/dist/
17+
/resources/experimental/models/
18+
1519
.vscode
1620
.angular
File renamed without changes.

CONTRIBUTING.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# How to Contribute
2+
3+
We would love to accept your patches and contributions to this project.
4+
5+
## Before you begin
6+
7+
### Sign our Contributor License Agreement
8+
9+
Contributions to this project must be accompanied by a
10+
[Contributor License Agreement](https://cla.developers.google.com/about) (CLA).
11+
You (or your employer) retain the copyright to your contribution; this simply
12+
gives us permission to use and redistribute your contributions as part of the
13+
project.
14+
15+
If you or your current employer have already signed the Google CLA (even if it
16+
was for a different project), you probably don't need to do it again.
17+
18+
Visit <https://cla.developers.google.com/> to see your current agreements or to
19+
sign a new one.
20+
21+
### Review our Community Guidelines
22+
23+
This project follows [Google's Open Source Community
24+
Guidelines](https://opensource.google/conduct/).
25+
26+
## Contribution process
27+
28+
If you believe a model should be included in our benchmark, please submit a pull request to add it as a new workload.
29+
30+
As of Q1 2026, the benchmark is under active development, and we are refining aspects such as the scoring calculation. We welcome your input on design considerations or other general feedback. Please open an issue to start a discussion.
31+
32+
To propose a new workload, please add it to the `resources/experimental` directory and submit a pull request. In your pull request, please explain the workload's relevance and provide technical details about its integration.
33+
34+
### Adding Experimental Workloads
35+
36+
- Update the `description` and `dependencies` in `resources/experimental/package.json`.
37+
- Inside `resources/experimental/src/index.mjs`, add a new async function and `ModelConfig` for your workload similar to the existing example.
38+
- Adjust the code inside `resources/experimental/src/index.html` if neede.
39+
- Update `resources/experimental/src/download-models.mjs` to download the model. You can refer to `resources/transformers-js/src/download-models.mjs` and `resources/litert-js/src/download-models.mjs` as examples.
40+
- Add licensing information of the new model in `resources/experimental/lisense/NOTICEmd` and add any required lince file in `resources/experimental/lisense/`.
41+
- Add `<your-new-workload-name>.mjs` inside `resources/experimental/src`, similar to the existing ones.
42+
- Add an entry and a plugin for the new workload in `resources/experimental/webpack.common.js`.
43+
- Update `.gitignore` if needed.
44+
- Run `npm run build` in the repository root directory. Alternatively, you can run `npm install` and `npm run build` inside `resources/experimental`.
45+
- Add the workload to `resources/default-tests.mjs` with the `Experimental-` prefix, analogous to the existing workloads.
46+
- Serve the overall runner via `npm run dev` in the repository root directory.
47+
- Browse to `http://localhost:8080` and click "Run" to run the benchmark.
48+
- To run individual experimental workloads, navigate to `http://localhost:8080/resources/experimental/dist/<workload>.html` then do `manualRun()` in dev console.
49+
50+
### Code Reviews
51+
52+
All submissions, including submissions by project members, require review. We
53+
use [GitHub pull requests](https://docs.github.com/articles/about-pull-requests)
54+
for this purpose.

README.md

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ See the Speedometer repo for a more detailed explanation, e.g., in which phases
1414
- Running a workload in the browser: TODO.
1515
- Inspecting and understanding metrics: TODO.
1616
- Most important files:
17-
- Workloads are in `resources/*/`.
17+
- Workloads are in `resources/transformers-js/` and `resources/litert-js`.
1818
- Shared files are in `resources/shared/`, which is depended-upon as a local package.
1919
- The default suite / tests to run are in `resources/default-tests.mjs`.
20-
- An example config (which can be loaded from externally) is in `resources/config.json`, but it is not used (more an example).
2120

2221
TODO: Add a screenshot of the runner, after updating logo and name and some minor styling of the workloads.
2322

@@ -27,43 +26,9 @@ TODO: Add a screenshot of the runner, after updating logo and name and some mino
2726
- `npm run dev` in the root directory to start the server
2827
- Navigate to `http://localhost:8080/resources/<workload-group>/dist/<workload>.html` (e.g. http://localhost:8080/resources/transformers-js/dist/feature-extraction-cpu.html ) then do `manualRun()` in dev console.
2928

30-
## How to Add a New Workload
31-
32-
### Transformers.js-based workloads
33-
34-
- Inside `resources/transformers-js/src/index.mjs`, add a new async function and `ModelConfig` for your workload.
35-
- Add the name of your model to `MODELS_TO_DOWNLOAD` in `resources/transformers-js/src/download-models.mjs`.
36-
- Add `<your-new-workload-name>.mjs` inside `resources/transformers-js/src`, similar to the existing ones.
37-
- Add an entry and a plugin for the new workload in `resources/transformers-js/webpack.commom.js`.
38-
- Run `npm install` and `npm run build` inside `resources/transformers-js` to produce output in `dist/`.
39-
- Add the workload to `resources/default-tests.mjs`, analogous to the existing workloads.
40-
- Serve the overall runner via `npm run dev` in the repository root directory.
41-
- Browse to http://localhost:8080, click on run to see the new workload.
42-
43-
### LiteRT.js-based workloads
44-
45-
- Inside `resources/litert-js/src/index.mjs`, add a new async function and `ModelConfig` for your workload.
46-
- Add the name of your model to `MODELS_TO_DOWNLOAD` in `resources/litert-js/src/download-models.mjs`.
47-
- Add `<your-new-workload-name>.mjs` inside `resources/litert-js/src`, similar to the existing ones.
48-
- Add an entry and a plugin for the new workload in `resources/litert-js/webpack.commom.js`.
49-
- Run `npm install` and `npm run build` inside `resources/litert-js` to produce output in `dist/`.
50-
- Add the workload to `resources/default-tests.mjs`, analogous to the existing workloads.
51-
- Serve the overall runner via `npm run dev` in the repository root directory.
52-
- Browse to http://localhost:8080, click on run to see the new workload.
53-
54-
### Other workloads
55-
56-
- Make a copy of `resources/transformers-js` and rename it to `resources/<your-selected-name>`.
57-
- Update the `description` and `dependencies` in `resources/<your-selected-name>/package.json`.
58-
- Adjust the code inside `resources/<your-selectedname>/src/index.html`, `resources/<your-selected-name>/src/index.mjs` and `resources/<your-selected-name>/src/download-models.mjs`.
59-
- Update entries and a plugins in `resources/<your-selected-name>/webpack.commom.js`.
60-
- Update `.gitignore`.
61-
- Delete `resources/<your-selected-name>/models` if you have any.
62-
- Run `npm install` and `npm run build` inside `resources/<your-selected-name>` to produce output in `dist/`.
63-
- Add the workload to `resources/default-tests.mjs`, analogous to the existing workloads.
64-
- Serve the overall runner via `npm run dev` in the repository root directory.
65-
- Browse to http://localhost:8080, click on run to see the new workload.
29+
## Contributing
6630

31+
See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out.
6732

6833
## Source Code Headers
6934

docs/contributing.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"license": "SEE LICENSE IN LICENSE",
1717
"scripts": {
18-
"build": "cd resources/litert-js && npm install && npm run build && cd ../transformers-js && npm install && npm run build",
18+
"build": "cd resources/litert-js && npm install && npm run build && cd ../transformers-js && npm install && npm run build && cd ../experimental && npm install && npm run build",
1919
"dev": "node tests/server.mjs",
2020
"lint:check": "eslint **/*.{js,mjs,jsx,ts,tsx}",
2121
"lint:fix": "eslint \"**/*.{js,mjs,jsx,ts,tsx}\" --fix",

resources/default-tests.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,16 @@ export const defaultSuites = [
133133
tags: ["default", "hand-detection", "webgpu", "litert-js"],
134134
type: "remote",
135135
},
136+
{
137+
name: "Experimental-Text2Text-Generation-wasm",
138+
url: "resources/experimental/dist/text2text-generation-cpu.html",
139+
tags: ["default", "text2text-generation", "wasm", "transformers-js"],
140+
type: "remote",
141+
},
142+
{
143+
name: "Experimental-Text2Text-Generation-webgpu",
144+
url: "resources/experimental/dist/text2text-generation-gpu.html",
145+
tags: ["default", "text2text-generation", "webgpu", "transformers-js"],
146+
type: "remote",
147+
},
136148
];

resources/experimental/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
An experimental workload runner.
2+
3+
## Build steps
4+
5+
Webpack bundles all the output into the `dist` folder.
6+
7+
```
8+
npm install
9+
npm run build
10+
```
11+
12+
## Requirements
13+
14+
The only requirement is an installation of Node, to be able to install dependencies and run scripts to serve a local server.
15+
16+
```
17+
* Node (min version: 18.13.0)
18+
* NPM (min version: 8.19.3)
19+
```

0 commit comments

Comments
 (0)