Skip to content

Add 43 example workflows for Hugging Face-style jobs - #2

Merged
ItayPodhajcer merged 11 commits into
mainfrom
add-example-workflows
Dec 2, 2026
Merged

ItayPodhajcer merged 11 commits into
mainfrom
add-example-workflows

Conversation

@ItayPodhajcer

@ItayPodhajcer ItayPodhajcer commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Adds 43 example workflows for the jobs machine-learning teams run over and over, the ones Hugging Face offers as ready-made operations: batch inference and labelling with an LLM, building datasets from documents, images and audio, fine-tuning and aligning models, evaluating, merging, quantizing and serving them. Each workflow is built from the swaleio task definitions on Swale Hub and splits its job into separate tasks, so a run's graph shows each step, its logs and its outputs, and only the steps that need a GPU hold one.

Layout

Path Holds
workflows/<name>/workflow.yaml the workflow
workflows/<name>/README.md what it does, its steps, inputs, output, what stays one script and why, and the licenses of its default model, data and packages
workflows/<name>/*.py the scripts it runs, if any
requirements/*.txt the pinned packages a script step installs
tools/check_workflows.py the check CI runs on every workflow

The repository README lists every workflow, grouped by the kind of job.

How scripts run

A workflow that runs scripts first clones this repository into the workspace with swaleio/git-clone, at its examples_ref input: a branch, a tag or a full commit SHA, main by default. CPU steps run on swaleio/python-3-13 and install their packages from a requirements/ file into /tmp; GPU steps run on swaleio/transformers, which already holds PyTorch and Transformers, and install anything else they need the same way. entity-extraction and web-text-curation, where several tasks need the same packages, install them once instead, in a step of their own, into packages/ on the workspace, and their tasks import them from there. Every script was written for this repository.

Scripts are split as far as a step's state allows: preparing, tokenizing, training, predicting and scoring are separate tasks, and only training and prediction hold a GPU. What stays one script is the training loop, which holds the model, the optimizer and the batches together on one GPU; each README says so.

The check

tools/check_workflows.py checks each workflow against a checkout of swaleio/task-definitions: the keys the workflow syntax allows, compute types, that each task names a definition without a version, passes only the inputs it declares and every input it requires, runs GPU definitions on GPU compute, that expressions name declared inputs and tasks, and that every script compiles.

CI checks every workflow against the catalog's main. With swaleio/task-definitions#102 merged, all 43 pass.

Licenses

The default models and datasets are under licenses that allow commercial use; each README names them. Every package a script step installs was checked, with the libraries its Linux wheel bundles as its license files list them. All are under permissive licenses except these, which are installed from PyPI unmodified:

  • certifi (MPL-2.0) and tqdm (MPL-2.0 and MIT).
  • The GCC runtime libraries libgfortran, in NumPy and SciPy, and libgomp, in scikit-learn and sentencepiece: GPL-3.0-or-later with the GCC Runtime Library Exception.
  • libquadmath in SciPy (LGPL-2.1-or-later), which tabular, object-detection and sentence-embeddings install, and libiconv linked into lxml (LGPL-2.1), which translation's scoring step installs.

🤖 Generated with Claude Code

ItayPodhajcer and others added 11 commits December 1, 2026 00:20
- Load image batches in-process: DataLoader workers ran out of a
  container's 64 MB /dev/shm and object detection then hung.
- semantic-dedup cuts texts longer than the embedding model takes and
  keeps rows whose request failed.
- merge-models merges NuExtract-1.5-tiny, a fine-tune of Qwen2.5-0.5B;
  Qwen2.5-Coder is not one, and that merge answered with zeros.
- Read the int size older image processor configs give, SetFit's list
  predictions, and match the llamacpp-convert page's tokenizer step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Datasets 5.2.0 cannot build a dataset in memory on Python 3.13, so
image preprocessing writes memory-mapped pixel arrays with NumPy, read
back through a small torch dataset, and vlm-finetune writes its rows
with PyArrow. vlm-finetune's rows are now prompt and completion
columns, so TRL computes the loss on the answer alone; over whole
conversations the image's tokens drowned the label out and the model
answered one class for every image. Object detection's training step
installs SciPy, which RT-DETR's loss needs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
git-clone now checks out its revision input, so the workflows that run
scripts clone this repository at examples_ref instead of downloading
and unpacking an archive. A revision is a branch, a tag or a full
commit SHA; the input descriptions and READMEs say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
serve-gguf repeated llamacpp-server's own example. score-gguf serves the
model once, has four client tasks answer GSM8K questions through it at the
same time, and scores the answers: 73.5% for Qwen2.5-1.5B-Instruct at
Q4_K_M, at 147 tokens per second with the server on 16 CPUs.

Import from GitHub reads only repositories on accounts the Swale GitHub App
is installed on and the user can access, which this repository is not for
anyone outside it. The README now says to upload the file, or to import
from a fork.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The classify-images and tabular READMEs quoted the scores their defaults
reached when run here. An example says what it does, not how it scored
when it was tried.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The error is not specific to Python 3.13: it comes from how datasets
pickles PyArrow tables for fingerprinting, and an open pull request in
datasets fixes it. The comment now points there, so the workaround can go
once that fix is released.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both workflows had several tasks installing the same packages: one per
shard in entity-extraction, one per stage in web-text-curation. An install
step now puts them in packages/ on the workspace, and the tasks import them
from there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
image-classification reads prepared, memory-mapped pixels, so it needs no
DataLoader workers; its comment now says that. object-detection keeps the
Trainer's default loader, with no comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each image is decoded and resized as its batch is built, so four loader
workers prepare the next batches while the GPU trains.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ItayPodhajcer
ItayPodhajcer marked this pull request as ready for review December 2, 2026 00:08
@ItayPodhajcer
ItayPodhajcer merged commit 2c3ddc7 into main Dec 2, 2026
1 check passed
@ItayPodhajcer
ItayPodhajcer deleted the add-example-workflows branch December 2, 2026 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant