Skip to content
Merged
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
6 changes: 5 additions & 1 deletion tools/check_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
python tools/check_workflows.py --catalog <path to a checkout of swaleio/task-definitions>

For each workflows/<name>/workflow.yaml it checks that the file parses, uses only
the keys the workflow syntax allows, names compute types Swale offers, and that
the keys the workflow syntax allows, has a description of at most 160 characters,
names compute types Swale offers, and that
every task names a catalog definition without a version, passes only inputs that
definition declares and every input it requires, and runs a definition that needs
a GPU on a GPU compute type and a CPU definition on a CPU one. Every Python script
Expand Down Expand Up @@ -47,6 +48,9 @@ def check_workflow(path, catalog):
errors.append(f"unknown top-level keys {sorted(unknown)}")
if not NAME_RE.match(str(wf.get("name", ""))):
errors.append(f"name {wf.get('name')!r} must be 1-100 letters, numbers, spaces, '.', '_' or '-'")
description = str(wf.get("description") or "")
if not 1 <= len(description) <= 160:
errors.append(f"description is {len(description)} characters; it must be 1-160")
default_compute = wf.get("compute_type")
if default_compute not in COMPUTE_TYPES:
errors.append(f"compute_type {default_compute!r} is not one Swale offers")
Expand Down
2 changes: 1 addition & 1 deletion workflows/caption-video/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Every step is its own task.
|-------|---------|-------------|
| `video_url` | the Sintel trailer | URL or workspace path of the video; anything FFmpeg reads. |
| `seconds_per_frame` | `4` | Seconds between captioned frames. |
| `model` | `Qwen/Qwen2-VL-2B-Instruct` | Vision-language model on the Hub. |
| `model` | `Qwen/Qwen2-VL-2B-Instruct` | Vision-language model on the Hugging Face Hub. |

The download reads the secret `hf_token`.

Expand Down
2 changes: 1 addition & 1 deletion workflows/caption-video/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ inputs:
description: Seconds between the frames that are captioned.
default: "4"
model:
description: Hub repo id of the vision-language model that captions.
description: Hugging Face repo id of the vision-language model that captions.
default: Qwen/Qwen2-VL-2B-Instruct

entry_point: main
Expand Down
6 changes: 3 additions & 3 deletions workflows/classify-images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ labels, a last step measures agreement and prints a confusion table.
| Label | `swaleio/vllm-batch` | `a100-1` |
| Join labels to the images' other columns, count each label, write Parquet | `swaleio/duckdb` | `cpu-4` |
| Measure agreement with existing labels, when `gold_column` is set | `swaleio/duckdb` | `cpu-4` |
| Upload to the Hub, when `hub_repo` is set | `swaleio/hf-upload` | `cpu-4` |
| Upload to the Hugging Face Hub, when `hub_repo` is set | `swaleio/hf-upload` | `cpu-4` |

Every step is its own task; only labelling holds a GPU.

Expand All @@ -25,15 +25,15 @@ model, or fine-tune one with the

| Input | Default | Description |
|-------|---------|-------------|
| `model` | `Qwen/Qwen2-VL-2B-Instruct` | Vision-language model on the Hub that vLLM serves. |
| `model` | `Qwen/Qwen2-VL-2B-Instruct` | Vision-language model on the Hugging Face Hub that vLLM serves. |
| `images` | the test split of `AI-Lab-Makerere/beans` | Parquet file or glob with a Hugging Face Image column, as a DuckDB path. |
| `image_column` | `image` | The Image column: a struct whose `bytes` field holds the encoded image. |
| `image_type` | `image/jpeg` | Media type of the encoded images. |
| `labels` | `angular_leaf_spot,bean_rust,healthy` | Labels the model chooses from, separated by commas. |
| `instruction` | a question about bean leaves | What the model is asked about each image. |
| `gold_column` | `labels` | Column of existing labels, as positions in `labels` from 0; empty skips the comparison. |
| `limit` | `1000` | Number of images to label. |
| `hub_repo` | empty | Hub dataset repo to upload `labels.parquet` to. |
| `hub_repo` | empty | Hugging Face dataset repo to upload `labels.parquet` to. |

The model download and the upload read the secret `hf_token`.

Expand Down
8 changes: 4 additions & 4 deletions workflows/classify-images/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Classify images with a vision-language model
description: Labels every image in a dataset with one of a fixed set of labels, using a vision-language model through vLLM batch inference, and measures agreement with existing labels.
description: Labels each image with one of a fixed set of labels, using a vision-language model through vLLM batch inference, and measures agreement with existing labels.
compute_type: cpu-4

inputs:
model:
description: Hub repo id of the vision-language model that labels.
description: Hugging Face repo id of the vision-language model that labels.
default: Qwen/Qwen2-VL-2B-Instruct
images:
description: Parquet file or glob holding the images in a Hugging Face Image column, as a DuckDB path such as hf://datasets/<owner>/<dataset>/<file>.
Expand All @@ -28,7 +28,7 @@ inputs:
description: Number of images to label.
default: "1000"
hub_repo:
description: Hub dataset repo to upload the labels to, as namespace/name. Leave empty to keep them on the workspace only.
description: Hugging Face dataset repo to upload the labels to, as namespace/name. Leave empty to keep them on the workspace only.
default: ""

entry_point: main
Expand Down Expand Up @@ -131,7 +131,7 @@ blocks:
upload:
tasks:
upload_labels:
name: Upload to the Hub
name: Upload to the Hugging Face Hub
uses: swaleio/hf-upload
args:
repo: ${{inputs.hub_repo}}
Expand Down
2 changes: 1 addition & 1 deletion workflows/compare-finetunes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Every step is its own task. The two branches hold a GPU each while they run.
| Input | Default | Description |
|-------|---------|-------------|
| `model` | `Qwen/Qwen2.5-0.5B-Instruct` | Model to fine-tune. |
| `dataset` | `HuggingFaceH4/ultrafeedback_binarized` | Hub dataset with a `messages` column. |
| `dataset` | `HuggingFaceH4/ultrafeedback_binarized` | Hugging Face dataset with a `messages` column. |
| `split` | `train_sft[:5000]` | Split, or slice of one, to train on. |
| `learning_rate_a` | `1.0e-5` | Learning rate of fine-tune A. |
| `learning_rate_b` | `5.0e-5` | Learning rate of fine-tune B. |
Expand Down
4 changes: 2 additions & 2 deletions workflows/compare-finetunes/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ compute_type: cpu-4

inputs:
model:
description: Hub repo id of the model to fine-tune.
description: Hugging Face repo id of the model to fine-tune.
default: Qwen/Qwen2.5-0.5B-Instruct
dataset:
description: Hub dataset with a messages column of chat turns.
description: Hugging Face dataset with a messages column of chat turns.
default: HuggingFaceH4/ultrafeedback_binarized
split:
description: Split of the dataset to train on.
Expand Down
2 changes: 1 addition & 1 deletion workflows/dataset-statistics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Every step is its own task.
| `min_chars` | `20` | Shortest text kept. |
| `max_chars` | `4000` | Longest text kept. |
| `rows_per_file` | `20000` | Rows per output file, roughly. |
| `hub_repo` | empty | Hub dataset repo to upload the files to, under `data/`. |
| `hub_repo` | empty | Hugging Face dataset repo to upload the files to, under `data/`. |

The upload reads the secret `hf_token`. For datasets of tens of gigabytes, give
the tasks `cpu-16`.
Expand Down
4 changes: 2 additions & 2 deletions workflows/dataset-statistics/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ inputs:
description: Rows in each output Parquet file, roughly.
default: "20000"
hub_repo:
description: Hub dataset repo to upload the files to, as namespace/name. Leave empty to keep them on the workspace only.
description: Hugging Face dataset repo to upload the files to, as namespace/name. Leave empty to keep them on the workspace only.
default: ""

entry_point: main
Expand Down Expand Up @@ -78,7 +78,7 @@ blocks:
upload:
tasks:
upload_files:
name: Upload to the Hub
name: Upload to the Hugging Face Hub
uses: swaleio/hf-upload
args:
repo: ${{inputs.hub_repo}}
Expand Down
4 changes: 2 additions & 2 deletions workflows/detect-objects/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Detect objects with a vision-language model
description: Asks a vision-language model for the bounding boxes of chosen objects in every image, compares the counts with existing annotations, and draws the boxes on sample images.
description: Asks a vision-language model for the bounding boxes of chosen objects in every image, compares the counts with annotations, and draws boxes on samples.
compute_type: cpu-4

inputs:
model:
description: Hub repo id of a vision-language model that answers with bounding boxes as JSON.
description: Hugging Face repo id of a vision-language model that answers with bounding boxes as JSON.
default: Qwen/Qwen3-VL-2B-Instruct
images:
description: Parquet file or glob with a Hugging Face Image column, as a DuckDB path.
Expand Down
2 changes: 1 addition & 1 deletion workflows/distill-model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trains.
| `student` | `Qwen/Qwen2.5-0.5B-Instruct` | Student model; all of its weights are trained. |
| `teacher` | `Qwen/Qwen2.5-1.5B-Instruct` | Teacher model; it must share the student's vocabulary. |
| `train_prompts` | `4000` | GSM8K training questions to distill on. |
| `hub_repo` | empty | Hub model repo to upload the student to. |
| `hub_repo` | empty | Hugging Face model repo to upload the student to. |

Training, the first evaluation and the upload read the secret `hf_token`.

Expand Down
8 changes: 4 additions & 4 deletions workflows/distill-model/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ compute_type: cpu-4

inputs:
student:
description: Hub repo id of the student model. All of its weights are trained.
description: Hugging Face repo id of the student model. All of its weights are trained.
default: Qwen/Qwen2.5-0.5B-Instruct
teacher:
description: Hub repo id of the teacher model; it must share the student's vocabulary.
description: Hugging Face repo id of the teacher model; it must share the student's vocabulary.
default: Qwen/Qwen2.5-1.5B-Instruct
train_prompts:
description: Number of GSM8K training questions to distill on.
default: "4000"
hub_repo:
description: Hub model repo to upload the distilled student to, as namespace/name. Leave empty to keep it on the workspace only.
description: Hugging Face model repo to upload the distilled student to, as namespace/name. Leave empty to keep it on the workspace only.
default: ""

entry_point: main
Expand Down Expand Up @@ -114,7 +114,7 @@ blocks:
upload:
tasks:
upload_model:
name: Upload to the Hub
name: Upload to the Hugging Face Hub
uses: swaleio/hf-upload
args:
repo: ${{inputs.hub_repo}}
Expand Down
2 changes: 1 addition & 1 deletion workflows/dpo-alignment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ it is. A 0.5B model trains on one A100 this way; for larger models, add
| `judge` | `Qwen/Qwen3-8B` | Judge model. |
| `train_split` | `train_prefs[:10000]` | Pairs of `HuggingFaceH4/ultrafeedback_binarized` to train on. |
| `eval_prompts` | `200` | Held-out prompts, from its `test_prefs` split. |
| `hub_repo` | empty | Hub model repo to upload the aligned model to. |
| `hub_repo` | empty | Hugging Face model repo to upload the aligned model to. |

The downloads, the training and the upload read the secret `hf_token`.

Expand Down
10 changes: 5 additions & 5 deletions workflows/dpo-alignment/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Align a model with DPO
description: Aligns a chat model to preference pairs with TRL's DPO, then has a judge model compare its answers with the base model's on held-out prompts and reports the win rate.
description: Aligns a chat model to preference pairs with TRL's DPO, then measures its win rate against the base model on held-out prompts with a judge model.
compute_type: cpu-4

inputs:
model:
description: Hub repo id of the chat model to align. All of its weights are trained.
description: Hugging Face repo id of the chat model to align. All of its weights are trained.
default: Qwen/Qwen2.5-0.5B-Instruct
judge:
description: Hub repo id of the judge model.
description: Hugging Face repo id of the judge model.
default: Qwen/Qwen3-8B
train_split:
description: Preference pairs to train on, from HuggingFaceH4/ultrafeedback_binarized.
Expand All @@ -16,7 +16,7 @@ inputs:
description: Number of held-out prompts the two models answer for the judge.
default: "200"
hub_repo:
description: Hub model repo to upload the aligned model to, as namespace/name. Leave empty to keep it on the workspace only.
description: Hugging Face model repo to upload the aligned model to, as namespace/name. Leave empty to keep it on the workspace only.
default: ""

entry_point: main
Expand Down Expand Up @@ -191,7 +191,7 @@ blocks:
upload:
tasks:
upload_model:
name: Upload to the Hub
name: Upload to the Hugging Face Hub
uses: swaleio/hf-upload
args:
repo: ${{inputs.hub_repo}}
Expand Down
6 changes: 3 additions & 3 deletions workflows/embed-dataset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ When the clients are done, the platform stops the server.
| Wait for the server, checking every 5 seconds | `swaleio/http-request` | `cpu-4` |
| For each shard: embed its rows, 32 per request | `swaleio/python-3-13` | `cpu-4` |
| Gather the vectors into `embeddings.parquet` | `swaleio/duckdb` | `cpu-4` |
| Upload to the Hub, when `hub_repo` is set | `swaleio/hf-upload` | `cpu-4` |
| Upload to the Hugging Face Hub, when `hub_repo` is set | `swaleio/hf-upload` | `cpu-4` |

Every step is its own task. Each client is a short Python script that uses only
the standard library.
Expand All @@ -26,11 +26,11 @@ reranker architectures and is built for this one job.

| Input | Default | Description |
|-------|---------|-------------|
| `model` | `BAAI/bge-small-en-v1.5` | Embedding model on the Hub. |
| `model` | `BAAI/bge-small-en-v1.5` | Embedding model on the Hugging Face Hub. |
| `dataset` | the train split of `openai/gsm8k` | Parquet file or glob, as a DuckDB path. |
| `text_column` | `question` | Column to embed. |
| `shards` | `["0", "1", "2", "3"]` | One client task per element. |
| `hub_repo` | empty | Hub dataset repo to upload the embeddings to, as `data/train.parquet`. |
| `hub_repo` | empty | Hugging Face dataset repo to upload the embeddings to, as `data/train.parquet`. |

The upload reads the secret `hf_token`.

Expand Down
8 changes: 4 additions & 4 deletions workflows/embed-dataset/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Embed a dataset
description: Serves an embedding model with Text Embeddings Inference and embeds every row of a dataset with several client tasks in parallel, one per shard, into one Parquet file.
description: Serves an embedding model with Text Embeddings Inference and embeds every row of a dataset into one Parquet file, with one client task per shard in parallel.
compute_type: cpu-4

inputs:
model:
description: Hub repo id of an embedding model Text Embeddings Inference serves.
description: Hugging Face repo id of an embedding model Text Embeddings Inference serves.
default: BAAI/bge-small-en-v1.5
dataset:
description: Parquet file or glob, as a DuckDB path.
Expand All @@ -16,7 +16,7 @@ inputs:
description: The client shards, as a JSON array; one client task runs per element, and each embeds every nth row.
default: '["0", "1", "2", "3"]'
hub_repo:
description: Hub dataset repo to upload the embeddings to, as namespace/name. Leave empty to keep them on the workspace only.
description: Hugging Face dataset repo to upload the embeddings to, as namespace/name. Leave empty to keep them on the workspace only.
default: ""

entry_point: main
Expand Down Expand Up @@ -125,7 +125,7 @@ blocks:
upload:
tasks:
upload_embeddings:
name: Upload to the Hub
name: Upload to the Hugging Face Hub
uses: swaleio/hf-upload
args:
repo: ${{inputs.hub_repo}}
Expand Down
10 changes: 5 additions & 5 deletions workflows/entity-extraction/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Entity extraction with GLiNER
# Extract named entities with GLiNER

Finds named entities of the types you name, such as people, organisations,
places and dates, in a collection of texts, with GLiNER. GLiNER takes the types
Expand All @@ -14,7 +14,7 @@ they found.
| Number the texts and cut each to `max_characters` | `swaleio/duckdb` | `cpu-4` |
| For each shard: extract the entities ([`extract.py`](extract.py)) | `swaleio/python-3-13` | `cpu-4` each |
| Count mentions per type and list the most frequent entities | `swaleio/duckdb` | `cpu-4` |
| Upload to the Hub, when `hub_repo` is set | `swaleio/hf-upload` | `cpu-4` |
| Upload to the Hugging Face Hub, when `hub_repo` is set | `swaleio/hf-upload` | `cpu-4` |

**What stays one script:** the extraction pass over a shard, one model call per
text.
Expand All @@ -35,15 +35,15 @@ installs.

| Input | Default | Description |
|-------|---------|-------------|
| `model` | `urchade/gliner_small-v2.1` | GLiNER model on the Hub. |
| `model` | `urchade/gliner_small-v2.1` | GLiNER model on the Hugging Face Hub. |
| `texts` | the test split of `abisee/cnn_dailymail` 3.0.0 | Parquet file or glob, as a DuckDB path. |
| `text_column` | `article` | Column holding each text. |
| `limit` | `200` | Texts to read. |
| `max_characters` | `1500` | Characters of each text that are read. |
| `labels` | `person,organization,location,date` | Entity types, as plain words. |
| `shards` | `["0", "1", "2", "3"]` | One extraction task per element. |
| `examples_ref` | `main` | Branch, tag or full commit SHA of this repository whose scripts run. |
| `hub_repo` | empty | Hub dataset repo to upload the entities to, as `data/train.parquet`. |
| `hub_repo` | empty | Hugging Face dataset repo to upload the entities to, as `data/train.parquet`. |

The download and the upload read the secret `hf_token`.

Expand All @@ -54,6 +54,6 @@ found in, its words, type, score and character offsets.

## Licenses

- Model: [urchade/gliner_small-v2.1](https://huggingface.co/urchade/gliner_small-v2.1), Apache-2.0; it loads the tokenizer of [microsoft/deberta-v3-small](https://huggingface.co/microsoft/deberta-v3-small), MIT, from the Hub.
- Model: [urchade/gliner_small-v2.1](https://huggingface.co/urchade/gliner_small-v2.1), Apache-2.0; it loads the tokenizer of [microsoft/deberta-v3-small](https://huggingface.co/microsoft/deberta-v3-small), MIT, from the Hugging Face Hub.
- Dataset: [abisee/cnn_dailymail](https://huggingface.co/datasets/abisee/cnn_dailymail), Apache-2.0.
- Packages the install step installs: GLiNER, Transformers and PyArrow (Apache-2.0), PyTorch (BSD-3-Clause), protobuf (BSD-3-Clause), with their dependencies under permissive licenses.
2 changes: 1 addition & 1 deletion workflows/entity-extraction/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

def main():
p = argparse.ArgumentParser()
p.add_argument("--model", required=True, help="Directory or Hub repo id of the GLiNER model")
p.add_argument("--model", required=True, help="Directory or Hugging Face repo id of the GLiNER model")
p.add_argument("--texts", required=True, help="Parquet file with id and text columns")
p.add_argument("--shard", type=int, required=True, help="This task's shard number")
p.add_argument("--shards", type=int, required=True, help="How many shards there are")
Expand Down
8 changes: 4 additions & 4 deletions workflows/entity-extraction/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Entity extraction with GLiNER
name: Extract named entities with GLiNER
description: Extracts named entities of types you name from a collection of texts with GLiNER, with no training, in several parallel CPU tasks, and aggregates them with SQL.
compute_type: cpu-4

inputs:
model:
description: Hub repo id of the GLiNER model.
description: Hugging Face repo id of the GLiNER model.
default: urchade/gliner_small-v2.1
texts:
description: Parquet file or glob of the texts, as a DuckDB path.
Expand All @@ -28,7 +28,7 @@ inputs:
description: Branch, tag or full commit SHA of swaleio/examples whose scripts run.
default: main
hub_repo:
description: Hub dataset repo to upload the entities to, as namespace/name. Leave empty to keep them on the workspace only.
description: Hugging Face dataset repo to upload the entities to, as namespace/name. Leave empty to keep them on the workspace only.
default: ""

entry_point: main
Expand Down Expand Up @@ -137,7 +137,7 @@ blocks:
upload:
tasks:
upload_entities:
name: Upload to the Hub
name: Upload to the Hugging Face Hub
uses: swaleio/hf-upload
args:
repo: ${{inputs.hub_repo}}
Expand Down
4 changes: 2 additions & 2 deletions workflows/extractive-qa/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Extractive question answering
# Fine-tune a model for extractive question answering

Fine-tunes a question-answering model to find the span of a document that
answers a question, here on long COVID-19 research papers, starting from a
Expand Down Expand Up @@ -31,7 +31,7 @@ only Python's standard library.
| `eval_every` | `10` | One document in this many is held out, with its questions. |
| `epochs` | `2` | Training epochs. |
| `examples_ref` | `main` | Branch, tag or full commit SHA of this repository whose scripts run. |
| `hub_repo` | empty | Hub model repo to upload the model to. |
| `hub_repo` | empty | Hugging Face model repo to upload the model to. |

The download and the upload read the secret `hf_token`.

Expand Down
Loading
Loading