Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/hygiene.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SPDX-FileCopyrightText: Copyright 2026 Arm Limited and affiliates.
#
# SPDX-License-Identifier: Apache-2.0

name: Hygiene

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

#* Stop stale workflows when pull requests are updated: https://stackoverflow.com/a/70972844
#* Does not apply to the main branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

# Declare default permissions as read only.
permissions: read-all

jobs:
hygiene:
runs-on: ah-ubuntu_24_04-c7g_2x-50
steps:
- name: Checkout Tool-Solutions
uses: actions/checkout@v6.0.2

- name: Set up Python
uses: actions/setup-python@v6.0.0
with:
python-version: "3.12"

- name: Install hygiene tooling
run: |
python -m pip install --user --no-cache-dir pre-commit==4.5.1 reuse==6.2.0
echo "$HOME/.local/bin" >> "$GITHUB_PATH"

# The manual stage contains every whole-repo-safe hook and excludes the
# copyright annotation hooks, which intentionally mutate changed files.
- name: Run whole-repo pre-commit checks
run: pre-commit run --all-files --hook-stage manual

- name: Run whole-repo REUSE lint
run: reuse lint
38 changes: 33 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# SPDX-FileCopyrightText: Copyright 2025 Arm Limited and affiliates.
# SPDX-FileCopyrightText: Copyright 2025, 2026 Arm Limited and affiliates.
#
# SPDX-License-Identifier: Apache-2.0

fail_fast: false
default_stages: [ pre-commit, manual ]

repos:
- repo: local
hooks:
# Python/YAML/shell: use hash comments (no --multi-line)
# Python/YAML/shell: use hash comments (no --multi-line). This hook
# mutates copyright metadata. Do not run this hook with --all-files.
- id: reuse-annotate-current-year-python-yaml-shell-files
name: REUSE Annotate (Python add current year, merge)
language: python
Expand All @@ -27,7 +29,8 @@ repos:
files: '(\.gitignore|\.dockerignore|requirements\.txt|bash_profile|Dockerfile|\.(py|yml|yaml|sh|bash))$'
stages: [ pre-commit ]

# JSON/Markdown/welcome.txt: use sidecar .license files
# JSON/Markdown/welcome.txt: use sidecar .license files. This hook
# mutates copyright metadata. Do not run this hook with --all-files.
- id: reuse-annotate-current-year-json-and-md
name: REUSE Annotate (JSON/Markdown/welcome.txt sidecar fallback add current year, merge)
language: python
Expand All @@ -49,12 +52,37 @@ repos:
- repo: https://github.com/fsfe/reuse-tool
rev: v6.2.0
hooks:
# File-level REUSE validation for changed files. CI also runs `reuse lint`
# across the whole repo because validation is non-mutating.
- id: reuse-lint-file
stages: [ pre-commit ]
name: "REUSE Compliant Copyright and License"

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
stages: [ pre-commit ]
- id: end-of-file-fixer
- id: mixed-line-ending
# Cheap changed-file guard for accidentally committed conflict markers.
# GitHub detects active merge conflicts, but this also catches conflict
# markers committed into files.
- id: check-merge-conflict
# Avoid adding paths that collide on case-insensitive filesystems.
- id: check-case-conflict
# Catch symlinks that point to missing targets. This is normally a no-op
# for this repo, but keeps broken links from entering via future changes.
- id: check-symlinks
- id: check-json
- id: check-yaml
# Enforce the size limit for every file in whole-repo CI checks as well as
# for newly added files in normal pre-commit runs.
- id: check-added-large-files
args: [ --maxkb=1024, --enforce-all ]
- id: check-executables-have-shebangs
# Keep script shebangs and executable bits consistent for runnable files.
- id: check-shebang-scripts-are-executable

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.15
hooks:
- id: ruff-check
14 changes: 12 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
SPDX-FileCopyrightText: Copyright 2025 Arm Limited and affiliates.
SPDX-FileCopyrightText: Copyright 2025, 2026 Arm Limited and affiliates.

SPDX-License-Identifier: Apache-2.0
-->
Expand Down Expand Up @@ -84,9 +84,19 @@ pre-commit --version
- Re-run:

```bash
pre-commit run --all-files
pre-commit run
```

The command above checks the currently staged files and may update their
copyright metadata. Inspect and stage any hook changes before rerunning it.

To run every repository-safe check across the whole repository without
changing copyright metadata, use:

```bash
pre-commit run --all-files --hook-stage manual
```

5. Push once everything passes:

```bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ Provide:

- A short summary of what changed (hashes/tags/wheels).
- The edits made to `./versions.sh` (and `./get-source.sh` if changed).
- Commands run and key results/errors.
- Commands run and key results/errors.
3 changes: 2 additions & 1 deletion ML-Frameworks/pytorch-aarch64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ WORKDIR /home/$DOCKER_USER
ENV PATH="/home/$DOCKER_USER/.local/bin:${PATH}"

# Install uv for quicker package installations (installed to ~/.local/bin with --user)
RUN python -m pip install --user uv==0.9.29
ENV UV_NO_CACHE=1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand not wanting to cache in the docker build phase to avoid releasing extra blobs, but I think it may be inconvenient for the user to find that uv doesn't cache (given that it is such a useful feature of uv!). Can we instead set this on each run command (or unset at the end of the build)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm setting the environment variable during the workshop stage. It should be wiped when we call the second FROM, i.e. when we create the user's workspace. Is there something I'm missing?

RUN python -m pip install --no-cache-dir --user uv==0.9.29

# Create virtual environment with uv
RUN uv venv /home/$DOCKER_USER/.venv
Expand Down
Empty file modified ML-Frameworks/pytorch-aarch64/examples/classify_image.py
100755 → 100644
Empty file.
1 change: 0 additions & 1 deletion ML-Frameworks/pytorch-aarch64/examples/executor/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import os
import runpy
import time
import sys
from urllib.parse import urlparse
import warnings
import zipfile
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion ML-Frameworks/pytorch-aarch64/examples/quantized_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ def forward(self, x):
model(data)
runtimes.append(time.time() - t0)

print('Quantized: %.4fms, FP32: %.4fms, Speedup: %.4f' % (np.min(runtimes)*1e3, np.min(fp32_runtimes)*1e3, np.min(fp32_runtimes)/np.min(runtimes)))
print('Quantized: %.4fms, FP32: %.4fms, Speedup: %.4f' % (np.min(runtimes)*1e3, np.min(fp32_runtimes)*1e3, np.min(fp32_runtimes)/np.min(runtimes)))
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ def eval_quantized_output(quantized_model, tokenizer, input_tensor, max_min_toke


def main(args):
name_string = f"{args.model}"
quantized_model_, tokenizer_, config_ = get_quantized_model(args)
quantized_model_, tokenizer_, _ = get_quantized_model(args)
input_tensor = tokenizer_.encode(args.prompt, return_tensors="pt")
eval_quantized_output(
quantized_model_, tokenizer_, input_tensor, args.max_new_tokens
Expand Down
3 changes: 2 additions & 1 deletion ML-Frameworks/pytorch-aarch64/examples/utils/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ def _postprocess_image_for_openimages_detection(

# resizing the box values from the 800x800 image to the original
# resolution.
resize = lambda x, orig: int((x / 800) * orig)
def resize(x, orig):
return int((x / 800) * orig)
left = resize(box[0], width)
top = resize(box[1], height)
right = resize(box[2], width)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def parse_arguments():
else:
try:
os.path.isfile(args["image"])
except:
except Exception as _:
assert False, "Image not found"

return args
1 change: 0 additions & 1 deletion ML-Frameworks/pytorch-aarch64/get-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,3 @@ git-shallow-clone https://github.com/pytorch/pytorch.git $PYTORCH_HASH
)
fi
)

4 changes: 2 additions & 2 deletions ML-Frameworks/tensorflow-aarch64/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright 2025 Arm Limited and affiliates.
# SPDX-FileCopyrightText: Copyright 2025, 2026 Arm Limited and affiliates.
#
# SPDX-License-Identifier: Apache-2.0

tensorflow/
results/
*.whl
*.whl
2 changes: 1 addition & 1 deletion ML-Frameworks/tensorflow-aarch64/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ where `YY` is the year, and `MM` the month of the increment.
- Updates TensorFlow hash to 7fd0883713c3c95b4ace0a637de461c731c1db1d from nightly, July 7th

### Removed
- Removes TensorFlow [PR #102272](https://github.com/tensorflow/tensorflow/pull/102272), which fixes AArch64 CPUIDInfo init.
- Removes TensorFlow [PR #102272](https://github.com/tensorflow/tensorflow/pull/102272), which fixes AArch64 CPUIDInfo init.
It was merged upstream on 17 June.

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion ML-Frameworks/tensorflow-aarch64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ WORKDIR /home/$DOCKER_USER
ENV PATH="/home/$DOCKER_USER/.local/bin:${PATH}"

# Install uv for quicker package installations (installed to ~/.local/bin with --user)
RUN python -m pip install --user uv==0.9.29
ENV UV_NO_CACHE=1
RUN python -m pip install --no-cache-dir --user uv==0.9.29

# Create virtual environment with uv
RUN uv venv /home/$DOCKER_USER/.venv
Expand Down
Empty file modified ML-Frameworks/tensorflow-aarch64/examples/classify_image.py
100755 → 100644
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import zipfile

import numpy as np
import yaml
from tqdm import tqdm

import tensorflow as tf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def parse_arguments():
else:
try:
os.path.isfile(args["image"])
except:
except Exception as _:
assert False, "Image not found"

return args