Skip to content

Commit 1a65eda

Browse files
authored
Merge branch 'master' into patch-1
2 parents 0e9958f + 7f5309f commit 1a65eda

169 files changed

Lines changed: 3387 additions & 2332 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ build:rbe --config=remote
4646
# Config for Google Cloud continuous integration that uses default credentials.
4747
build:ci --config=bes
4848

49+
4950
# This flag is needed to prevent the bazel cache from being invalidated when
5051
# running bazel via `yarn bazel`.
5152
# See https://github.com/angular/angular/issues/27514.

.github/workflows/stale.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ jobs:
3939
# Limit the No. of API calls in one run default value is 30.
4040
operations-per-run: 500
4141
# Prevent to remove stale label when PRs or issues are updated.
42-
remove-stale-when-updated: false
42+
remove-stale-when-updated: true
43+
# List of labels to remove when issues/PRs unstale.
44+
labels-to-remove-when-unstale: 'stat:awaiting response'
4345
# comment on issue if not active for more then 7 days.
4446
stale-issue-message: 'This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.'
4547
# comment on PR if not active for more then 14 days.
@@ -63,4 +65,4 @@ jobs:
6365
# override stale to stalled for PR
6466
stale-pr-label: 'stale'
6567
# override stale to stalled for Issue
66-
stale-issue-label: "stale"
68+
stale-issue-label: "stale"

.github/workflows/tfjs-ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: TFJS Continuous Integration
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: bazel-contrib/setup-bazel@0.14.0
18+
with:
19+
# Avoid downloading Bazel every time.
20+
bazelisk-cache: true
21+
# Store build cache per workflow.
22+
disk-cache: ${{ github.workflow }}-cpu
23+
# Share repository cache between workflows.
24+
repository-cache: true
25+
- uses: actions/checkout@v4
26+
- name: Test TFJS CPU
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 20.x
30+
cache: 'npm'
31+
- run: npm i -g yarn
32+
- run: yarn install
33+
- run: yarn test-cpu
34+
35+
test-gpu-mac:
36+
runs-on: macos-latest-xlarge # consumer gpu
37+
steps:
38+
- uses: bazel-contrib/setup-bazel@0.14.0
39+
with:
40+
# Avoid downloading Bazel every time.
41+
bazelisk-cache: true
42+
# Store build cache per workflow.
43+
disk-cache: ${{ github.workflow }}-gpu-mac
44+
# Share repository cache between workflows.
45+
repository-cache: true
46+
- uses: actions/checkout@v4
47+
- name: Test TFJS GPU
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: 20.x
51+
cache: 'npm'
52+
- run: npm i -g yarn
53+
- run: yarn install
54+
- run: yarn test-gpu
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: TFJS Nightly Release and Publish Test
2+
3+
on:
4+
schedule:
5+
- cron: '0 5 * * *' # Runs daily at 5:00 AM UTC
6+
workflow_dispatch: # Allows manual triggering
7+
8+
permissions:
9+
contents: read # Default permissions, adjust if the script needs to write to the repo
10+
11+
jobs:
12+
nightly_release_verification:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Bazel
19+
uses: bazel-contrib/setup-bazel@0.14.0
20+
with:
21+
bazelisk-cache: true
22+
disk-cache: ${{ github.workflow }}-nightly-release
23+
repository-cache: true
24+
25+
- name: Setup Node.js and Yarn
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20.x # Using a current LTS version of Node.js
29+
cache: 'yarn'
30+
31+
- name: Install Yarn globally (if not already cached by setup-node with yarn cache)
32+
run: npm i -g yarn
33+
34+
- name: Install top-level dependencies
35+
run: yarn install --frozen-lockfile
36+
37+
- name: Run Nightly Verdaccio Test Script
38+
env:
39+
RELEASE: 'true' # Set RELEASE to true as in the original config
40+
run: |
41+
set -eEuo pipefail
42+
yarn release-tfjs --dry --guess-version release --use-local-changes --force
43+
# The original script changes directory to a temporary location created by the release script.
44+
# This assumes /tmp/ is accessible and the path structure is consistent.
45+
# If release-e2e.sh is relative to the checkout root after the release script prep, adjust path.
46+
if [ -d "/tmp/tfjs-release/tfjs/e2e/" ]; then
47+
cd /tmp/tfjs-release/tfjs/e2e/
48+
bash scripts/release-e2e.sh
49+
else
50+
echo "Error: Expected directory /tmp/tfjs-release/tfjs/e2e/ not found after release script."
51+
exit 1
52+
fi
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: TFJS Release Branch Publish Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'tfjs_**' # Matches branches starting with tfjs_, e.g., tfjs_1.2.3, tfjs_core
7+
workflow_dispatch: # Allows manual triggering
8+
9+
permissions:
10+
contents: read # Default permissions, adjust if the script needs to write to the repo
11+
12+
jobs:
13+
release_e2e_test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Bazel
20+
uses: bazel-contrib/setup-bazel@0.14.0
21+
with:
22+
bazelisk-cache: true
23+
disk-cache: ${{ github.workflow }}-release-e2e
24+
repository-cache: true
25+
26+
- name: Setup Node.js and Yarn
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 20.x
30+
cache: 'yarn' # Changed from 'npm' in example to 'yarn' as primary tool here
31+
32+
- name: Install Yarn globally (if not already cached by setup-node with yarn cache)
33+
run: npm i -g yarn
34+
35+
- name: Install top-level dependencies
36+
run: yarn install --frozen-lockfile
37+
38+
- name: Run E2E Release Script
39+
working-directory: ./e2e # Sets the directory for this step
40+
env:
41+
RELEASE: 'true' # Set RELEASE to true as requested
42+
run: bash ./scripts/release-e2e.sh

BUILD.bazel

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,31 @@ headless_flag(
4949
)
5050

5151
test_suite(
52-
name = "tests",
52+
name = "tests_cpu",
5353
tests = [
5454
"//tfjs-backend-cpu:tests",
5555
"//tfjs-backend-wasm:tests",
56-
"//tfjs-backend-webgl:tests",
5756
"//tfjs-converter:tests",
5857
"//tfjs-core:tests",
5958
"//tfjs-data:tests",
60-
"//tfjs-layers:tests",
6159
"//tfjs-tfdf:tests",
6260
"//tfjs-tflite:tests",
6361
],
6462
)
63+
64+
test_suite(
65+
name = "tests_gpu",
66+
tests = [
67+
"//tfjs-backend-webgl:tests",
68+
"//tfjs-backend-webgpu:tests",
69+
"//tfjs-layers:tests",
70+
],
71+
)
72+
73+
test_suite(
74+
name = "tests",
75+
tests = [
76+
":tests_cpu",
77+
":tests_gpu",
78+
],
79+
)

GALLERY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ Please reach out to us if you'd like to put your project on the list.
7373
- [Brainchop.org](https://neuroneural.github.io/brainchop/) - Brings automatic 3D MRI segmentation capability to neuroimaging by running a deep learning model in the web-browser on the user side - By Mohamed Masoud and Sergey Plis. [[demo](https://neuroneural.github.io/brainchop/)][[repo](https://github.com/neuroneural/brainchop)][[wiki](https://github.com/neuroneural/brainchop/wiki)]
7474
- [chestxray.ai](https://github.com/jordimassaguerpla/chestxray.ai) - X-Ray image of you Chest, and predicts the probability of having any of these 4 diseases:Cardiomegaly,Mass,Pneumotorax,Edema - By Jordi Massaguer Pla. [[repo](https://github.com/jordimassaguerpla/chestxray.ai)]
7575
- [asanAI](https://asanai.scads.ai/) - A tool to experiment with different layer types, optimizers and so on with default and custom data, fully in the browser, see and visualize results and export to a python-model that can be run locally.
76-
76+
- [TF.js-TFLite Object Detection](https://github.com/NSTiwari/TFJS-TFLite-Object-Detection) - This project is an implementation of object detection to detect different categories of waste in real-time directly on the browser using the TF.js-TFLite Web API - by [Nitin Tiwari](https://linkedin.com/in/tiwari-nitin).
77+
7778
## Tutorials / Codelabs
7879

7980
These tutorials augment the [official tutorials](https://js.tensorflow.org/tutorials/).

WORKSPACE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,13 @@ load("@rules_python//python:repositories.bzl", "python_register_toolchains")
226226
# https://github.com/bazelbuild/rules_python/pull/713
227227
# https://github.com/GoogleCloudPlatform/cloud-builders/issues/641
228228
python_register_toolchains(
229-
name = "python3_8",
229+
name = "python3_9",
230230
ignore_root_user_error = True,
231231
# Available versions are listed in @rules_python//python:versions.bzl.
232-
python_version = "3.8",
232+
python_version = "3.9",
233233
)
234234

235-
load("@python3_8//:defs.bzl", "interpreter")
235+
load("@python3_9//:defs.bzl", "interpreter")
236236
load("@rules_python//python:pip.bzl", "pip_parse")
237237

238238
pip_parse(

e2e/benchmarks/benchmark_util.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ function generateInputFromDef(inputDefs, isForGraphModel = false) {
107107
// the data generated maybe outside of [min, max].
108108
inputTensor = tf.clipByValue(generatedRaw, min, max);
109109
generatedRaw.dispose();
110+
} else if (inputDef.dtype === 'string') {
111+
size = tf.util.sizeFromShape(inputDef.shape);
112+
data = [...Array(size)].map(
113+
() => Math.random().toString(36).substring(2, 7));
114+
inputTensor = tf.tensor(data, inputShape, inputDef.dtype);
110115
} else {
111116
throw new Error(
112117
`The ${inputDef.dtype} dtype of '${inputDef.name}' input ` +

e2e/custom_module/blazeface/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,10 @@
366366
"@webassemblyjs/ast" "1.11.1"
367367
"@xtuc/long" "4.2.2"
368368

369-
"@webgpu/types@0.1.30":
370-
version "0.1.30"
371-
resolved "https://registry.yarnpkg.com/@webgpu/types/-/types-0.1.30.tgz#b6406dc4a1c1e0d469028ceb30ddffbbd2fa706c"
372-
integrity sha512-9AXJSmL3MzY8ZL//JjudA//q+2kBRGhLBFpkdGksWIuxrMy81nFrCzj2Am+mbh8WoU6rXmv7cY5E3rdlyru2Qg==
369+
"@webgpu/types@0.1.38":
370+
version "0.1.38"
371+
resolved "https://registry.yarnpkg.com/@webgpu/types/-/types-0.1.38.tgz#6fda4b410edc753d3213c648320ebcf319669020"
372+
integrity sha512-7LrhVKz2PRh+DD7+S+PVaFd5HxaWQvoMqBbsV9fNJO1pjUs1P8bM2vQVNfk+3URTqbuTI7gkXi0rfsN0IadoBA==
373373

374374
"@webpack-cli/info@^1.1.0":
375375
version "1.1.0"

0 commit comments

Comments
 (0)