diff --git a/README.md b/README.md index 5e063d8..b7cd995 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Swale example workflows Ready-to-run [Swale](https://swale.io) workflows for the jobs machine-learning -teams run over and over: batch inference and labelling with an LLM, building +teams run over and over: batch inference and labeling with an LLM, building datasets from documents, images and audio, fine-tuning and aligning models, evaluating, merging, quantizing and serving them. Each workflow is a YAML file built from the task definitions published by `swaleio` on Swale Hub, and splits @@ -52,7 +52,7 @@ tools/check_workflows.py the check CI runs on every workflow ## Workflows -### Inference, labelling and evaluation with LLMs +### Inference, labeling and evaluation with LLMs | Workflow | What it does | GPU steps | |----------|--------------|-----------| @@ -60,7 +60,7 @@ tools/check_workflows.py the check CI runs on every workflow | [label-text](workflows/label-text) | Labels texts with one of a fixed set of labels and measures agreement | vLLM batch | | [classify-images](workflows/classify-images) | Labels images with a vision-language model and measures agreement | vLLM batch | | [detect-objects](workflows/detect-objects) | Finds objects as bounding boxes with a vision-language model | vLLM batch | -| [caption-video](workflows/caption-video) | Captions a video frame by frame and summarises it | vLLM batch | +| [caption-video](workflows/caption-video) | Captions a video frame by frame and summarizes it | vLLM batch | | [ocr-pages](workflows/ocr-pages) | Transcribes a PDF page by page with a vision-language model | vLLM batch | | [synthetic-reasoning-data](workflows/synthetic-reasoning-data) | Builds a chain-of-thought dataset, judged against references | vLLM batch | | [llm-as-a-judge](workflows/llm-as-a-judge) | Scores a model's answers from 1 to 10 with a judge model | vLLM batch | @@ -90,8 +90,8 @@ tools/check_workflows.py the check CI runs on every workflow | [dpo-alignment](workflows/dpo-alignment) | Aligns a model with DPO and measures its win rate with a judge | TRL DPO, vLLM batch | | [kto-alignment](workflows/kto-alignment) | Aligns a model with KTO and measures its win rate with a judge | TRL KTO, vLLM batch | | [reward-model](workflows/reward-model) | Trains a reward model and scores held-out preference pairs | TRL reward | -| [grpo-math](workflows/grpo-math) | Trains maths reasoning with GRPO and a checked reward | TRL GRPO, lm-eval | -| [rloo-math](workflows/rloo-math) | Trains maths reasoning with RLOO and a checked reward | TRL RLOO, lm-eval | +| [grpo-math](workflows/grpo-math) | Trains math reasoning with GRPO and a checked reward | TRL GRPO, lm-eval | +| [rloo-math](workflows/rloo-math) | Trains math reasoning with RLOO and a checked reward | TRL RLOO, lm-eval | | [distill-model](workflows/distill-model) | Distills a larger model into a smaller one | TRL distillation, lm-eval | | [vlm-finetune](workflows/vlm-finetune) | Fine-tunes a vision-language model and compares accuracy | TRL SFT, vLLM batch | @@ -101,7 +101,7 @@ tools/check_workflows.py the check CI runs on every workflow |----------|--------------|-----------| | [merge-models](workflows/merge-models) | Merges two fine-tunes with mergekit and scores all three | lm-eval | | [quantize-and-pick](workflows/quantize-and-pick) | Quantizes to several presets and keeps the smallest good one | llama.cpp | -| [score-gguf](workflows/score-gguf) | Scores a GGUF model's maths answers on a CPU, with parallel clients | none by default | +| [score-gguf](workflows/score-gguf) | Scores a GGUF model's math answers on a CPU, with parallel clients | none by default | ### Training task-specific models with scripts @@ -111,7 +111,7 @@ tools/check_workflows.py the check CI runs on every workflow | [text-regression](workflows/text-regression) | Fine-tunes an encoder to predict a number per text | training, prediction | | [token-classification](workflows/token-classification) | Fine-tunes an encoder to tag named entities | training, tagging | | [extractive-qa](workflows/extractive-qa) | Fine-tunes a model to find answers in long documents | training, scoring tokens | -| [summarization](workflows/summarization) | Fine-tunes a sequence-to-sequence model to summarise | training, generation | +| [summarization](workflows/summarization) | Fine-tunes a sequence-to-sequence model to summarize | training, generation | | [translation](workflows/translation) | Fine-tunes a translation model | training, generation | | [sentence-embeddings](workflows/sentence-embeddings) | Fine-tunes a sentence-embedding model for retrieval | training, embedding | | [setfit-classifier](workflows/setfit-classifier) | Trains a few-shot classifier with SetFit | training, prediction | diff --git a/workflows/caption-video/README.md b/workflows/caption-video/README.md index c74340e..70112bb 100644 --- a/workflows/caption-video/README.md +++ b/workflows/caption-video/README.md @@ -2,7 +2,7 @@ Describes a video in words. FFmpeg takes one frame every few seconds, a vision-language model writes a one-sentence caption of each frame, and the same -model then reads the timed captions and summarises the whole video in a +model then reads the timed captions and summarizes the whole video in a paragraph. | Step | Task definition | Compute | @@ -12,7 +12,7 @@ paragraph. | Write one caption request per frame, with the frame inline | `swaleio/duckdb` | `cpu-4` | | Caption the frames | `swaleio/vllm-batch` | `a100-1` | | Join captions to their times, write the summary request | `swaleio/duckdb` | `cpu-4` | -| Summarise the video | `swaleio/vllm-batch` | `a100-1` | +| Summarize the video | `swaleio/vllm-batch` | `a100-1` | | Write the summary out and print it | `swaleio/duckdb` | `cpu-4` | Every step is its own task. diff --git a/workflows/caption-video/workflow.yaml b/workflows/caption-video/workflow.yaml index 716ccc7..dc0429e 100644 --- a/workflows/caption-video/workflow.yaml +++ b/workflows/caption-video/workflow.yaml @@ -96,13 +96,13 @@ blocks: 'messages': [{'role': 'user', 'content': 'These are captions of frames from one video, with the second each frame is from:\n' || string_agg(second || 's: ' || caption, '\n' ORDER BY frame) || - '\n\nSummarise what happens in the video in a short paragraph.'}], + '\n\nSummarize what happens in the video in a short paragraph.'}], 'max_tokens': 256, 'temperature': 0} AS body FROM captions ) TO '${{env.WORKFLOW_STORAGE}}/summary-request.jsonl' (FORMAT json); - summarise: - name: Summarise video + summarize: + name: Summarize video uses: swaleio/vllm-batch compute_type: a100-1 start_on: @@ -116,7 +116,7 @@ blocks: name: Show summary uses: swaleio/duckdb start_on: - - summarise + - summarize args: sql: | COPY (SELECT response.body.choices[1].message.content AS summary diff --git a/workflows/classify-images/README.md b/workflows/classify-images/README.md index f281ea3..aa407b6 100644 --- a/workflows/classify-images/README.md +++ b/workflows/classify-images/README.md @@ -15,9 +15,9 @@ labels, a last step measures agreement and prints a confusion table. | Measure agreement with existing labels, when `gold_column` is set | `swaleio/duckdb` | `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. +Every step is its own task; only labeling holds a GPU. -For a specialised task, a small model asked cold may label poorly. Use a larger +For a specialized task, a small model asked cold may label poorly. Use a larger model, or fine-tune one with the [image classification](../image-classification) workflow. diff --git a/workflows/classify-images/workflow.yaml b/workflows/classify-images/workflow.yaml index 62d920f..3ea896e 100644 --- a/workflows/classify-images/workflow.yaml +++ b/workflows/classify-images/workflow.yaml @@ -89,13 +89,13 @@ blocks: - label args: sql: | - CREATE TABLE labelled AS + CREATE TABLE labeled AS SELECT i.*, trim(r.response.body.choices[1].message.content) AS llm_label FROM '${{env.WORKFLOW_STORAGE}}/images.parquet' i JOIN read_json('${{env.WORKFLOW_STORAGE}}/results.jsonl') r USING (custom_id) ORDER BY custom_id; - SELECT llm_label, count(*) AS images FROM labelled GROUP BY ALL ORDER BY images DESC; - COPY labelled TO '${{env.WORKFLOW_STORAGE}}/labels.parquet' (FORMAT parquet); + SELECT llm_label, count(*) AS images FROM labeled GROUP BY ALL ORDER BY images DESC; + COPY labeled TO '${{env.WORKFLOW_STORAGE}}/labels.parquet' (FORMAT parquet); compare: name: Compare when existing labels are given diff --git a/workflows/distill-model/README.md b/workflows/distill-model/README.md index 06b2381..ae359df 100644 --- a/workflows/distill-model/README.md +++ b/workflows/distill-model/README.md @@ -1,7 +1,7 @@ # Distill a larger model into a smaller one Teaches a small model to behave like a larger one of the same family on your -prompts. The student answers maths prompts and learns to match the teacher's +prompts. The student answers math prompts and learns to match the teacher's word-by-word distribution over the answer; the student is scored on GSM8K's test split before and after. diff --git a/workflows/distill-model/workflow.yaml b/workflows/distill-model/workflow.yaml index b00c169..2cad11c 100644 --- a/workflows/distill-model/workflow.yaml +++ b/workflows/distill-model/workflow.yaml @@ -1,5 +1,5 @@ name: Distill a larger model into a smaller one -description: Distills a larger teacher into a smaller student of the same family on maths prompts with TRL, and compares the student's GSM8K score before and after. +description: Distills a larger teacher into a smaller student of the same family on math prompts with TRL, and compares the student's GSM8K score before and after. compute_type: cpu-4 inputs: diff --git a/workflows/dpo-alignment/workflow.yaml b/workflows/dpo-alignment/workflow.yaml index 32d7706..7903047 100644 --- a/workflows/dpo-alignment/workflow.yaml +++ b/workflows/dpo-alignment/workflow.yaml @@ -127,7 +127,7 @@ blocks: args: sql: | -- Each pair is judged with the aligned answer first on even rows and second on odd - -- rows, so a judge that prefers one position does not favour either model. + -- rows, so a judge that prefers one position does not favor either model. CREATE TABLE pairs AS SELECT p.custom_id, p.prompt, b.response.body.choices[1].message.content AS base, diff --git a/workflows/entity-extraction/README.md b/workflows/entity-extraction/README.md index e301415..5d8f70d 100644 --- a/workflows/entity-extraction/README.md +++ b/workflows/entity-extraction/README.md @@ -1,6 +1,6 @@ # Extract named entities with GLiNER -Finds named entities of the types you name, such as people, organisations, +Finds named entities of the types you name, such as people, organizations, places and dates, in a collection of texts, with GLiNER. GLiNER takes the types as plain words when it runs, so there is nothing to train. The texts are split into shards that several CPU tasks read at the same time, and SQL gathers what diff --git a/workflows/extractive-qa/preprocess.py b/workflows/extractive-qa/preprocess.py index 0f2b057..ac1248e 100644 --- a/workflows/extractive-qa/preprocess.py +++ b/workflows/extractive-qa/preprocess.py @@ -1,7 +1,7 @@ """Turns question and context pairs into overlapping token windows for extractive QA, on a CPU. A context longer than one window is split into several, overlapping by --stride -tokens. Training windows are labelled with the answer's start and end token, +tokens. Training windows are labeled with the answer's start and end token, or with the first token when the answer is not inside the window. Evaluation windows keep each token's character offsets in the context, so answers can be read back out of the text later. diff --git a/workflows/extractive-qa/score.py b/workflows/extractive-qa/score.py index af11eb9..49492c0 100644 --- a/workflows/extractive-qa/score.py +++ b/workflows/extractive-qa/score.py @@ -1,6 +1,6 @@ """Scores predicted answers with exact match and token F1, on a CPU, with the standard library only. -Both compare normalised text: lower case, without punctuation, articles or +Both compare normalized text: lower case, without punctuation, articles or extra spaces. A question with several reference answers takes the best score over them. """ @@ -12,14 +12,14 @@ from collections import Counter -def normalise(text): +def normalize(text): text = "".join(ch for ch in text.lower() if ch not in set(string.punctuation)) text = re.sub(r"\b(a|an|the)\b", " ", text) return " ".join(text.split()) def f1(prediction, reference): - predicted, gold = normalise(prediction).split(), normalise(reference).split() + predicted, gold = normalize(prediction).split(), normalize(reference).split() common = sum((Counter(predicted) & Counter(gold)).values()) if not predicted or not gold: return float(predicted == gold) @@ -40,7 +40,7 @@ def main(): for line in f: row = json.loads(line) references = row["answers"]["text"] - exact += max(float(normalise(row["prediction"]) == normalise(r)) for r in references) + exact += max(float(normalize(row["prediction"]) == normalize(r)) for r in references) overlap += max(f1(row["prediction"], r) for r in references) count += 1 scores = {"questions": count, "exact_match": round(100 * exact / count, 2), "f1": round(100 * overlap / count, 2)} diff --git a/workflows/extractive-qa/train.py b/workflows/extractive-qa/train.py index 5d84fb9..fe2b6ab 100644 --- a/workflows/extractive-qa/train.py +++ b/workflows/extractive-qa/train.py @@ -1,4 +1,4 @@ -"""Fine-tunes an extractive question-answering model on labelled windows, on a GPU. +"""Fine-tunes an extractive question-answering model on labeled windows, on a GPU. The training loop is the one step of the workflow that stays a single script: it holds the model, the optimizer and the batches together on one GPU. diff --git a/workflows/grpo-math/README.md b/workflows/grpo-math/README.md index c45031b..9b69034 100644 --- a/workflows/grpo-math/README.md +++ b/workflows/grpo-math/README.md @@ -1,9 +1,9 @@ -# Train maths reasoning with GRPO +# Train math reasoning with GRPO -Trains a model to solve maths word problems with group relative policy +Trains a model to solve math word problems with group relative policy optimization. For each question the model writes several answers; TRL's `accuracy_reward` gives 1 to the answers whose final result matches the -reference, checked with `math-verify`, and the model learns to favour them. The +reference, checked with `math-verify`, and the model learns to favor them. The base model and the trained model are both scored on GSM8K's test split. | Step | Task definition | Compute | diff --git a/workflows/grpo-math/workflow.yaml b/workflows/grpo-math/workflow.yaml index 6bcab77..8d4f9d9 100644 --- a/workflows/grpo-math/workflow.yaml +++ b/workflows/grpo-math/workflow.yaml @@ -1,5 +1,5 @@ -name: Train maths reasoning with GRPO -description: Trains a model on maths word problems with TRL's GRPO, rewarding answers that match the reference, and compares its GSM8K score before and after. +name: Train math reasoning with GRPO +description: Trains a model on math word problems with TRL's GRPO, rewarding answers that match the reference, and compares its GSM8K score before and after. compute_type: cpu-4 inputs: diff --git a/workflows/image-classification/README.md b/workflows/image-classification/README.md index bb82f91..1dc246b 100644 --- a/workflows/image-classification/README.md +++ b/workflows/image-classification/README.md @@ -2,7 +2,7 @@ Fine-tunes a vision transformer to put images into classes, here bean leaves into healthy, angular leaf spot and bean rust, and measures it on held-out -images. Checking, resizing and normalising the images runs on a CPU, so the +images. Checking, resizing and normalizing the images runs on a CPU, so the GPU is held only for training and prediction. | Step | Task definition | Compute | @@ -10,7 +10,7 @@ GPU is held only for training and prediction. | Fetch this repository's scripts at `examples_ref` | `swaleio/git-clone` | `cpu-4` | | Fetch the model | `swaleio/hf-download` | `cpu-4` | | Prepare the splits, count each label | `swaleio/duckdb` | `cpu-4` | -| Decode, check, resize and normalise every image ([`preprocess.py`](preprocess.py)) | `swaleio/python-3-13` | `cpu-4` | +| Decode, check, resize and normalize every image ([`preprocess.py`](preprocess.py)) | `swaleio/python-3-13` | `cpu-4` | | Train ([`train.py`](train.py)) | `swaleio/transformers` | `a100-1` | | Predict the eval split ([`predict.py`](predict.py)) | `swaleio/transformers` | `a100-1` | | Compute accuracy, per-class F1 and macro F1 | `swaleio/duckdb` | `cpu-4` | diff --git a/workflows/image-classification/preprocess.py b/workflows/image-classification/preprocess.py index 40a0c43..976b1bb 100644 --- a/workflows/image-classification/preprocess.py +++ b/workflows/image-classification/preprocess.py @@ -1,8 +1,8 @@ -"""Checks, resizes and normalises images for a vision model, on a CPU. +"""Checks, resizes and normalizes images for a vision model, on a CPU. Every image is decoded and checked; one that cannot be decoded is dropped and counted. The rest are converted to RGB, resized to the model's input size and -normalised with the model's own mean and standard deviation, read from its +normalized with the model's own mean and standard deviation, read from its preprocessor_config.json. Each split is written as one file of float32 pixel arrays, its labels and its shape, which the training task memory-maps, so it spends its GPU time training. diff --git a/workflows/image-classification/workflow.yaml b/workflows/image-classification/workflow.yaml index 75dd4bf..84adca6 100644 --- a/workflows/image-classification/workflow.yaml +++ b/workflows/image-classification/workflow.yaml @@ -69,7 +69,7 @@ blocks: ORDER BY split DESC, label; check_images: - name: Check, resize and normalise the images + name: Check, resize and normalize the images uses: swaleio/python-3-13 start_on: - fetch_scripts diff --git a/workflows/image-regression/README.md b/workflows/image-regression/README.md index da4bf0b..a0128e5 100644 --- a/workflows/image-regression/README.md +++ b/workflows/image-regression/README.md @@ -10,7 +10,7 @@ expression over the dataset's columns to predict something else. | Fetch this repository's scripts at `examples_ref` | `swaleio/git-clone` | `cpu-4` | | Fetch the model | `swaleio/hf-download` | `cpu-4` | | Prepare the splits and compute the target, print its range | `swaleio/duckdb` | `cpu-4` | -| Decode, check, resize and normalise every image ([`preprocess.py`](../image-classification/preprocess.py)) | `swaleio/python-3-13` | `cpu-4` | +| Decode, check, resize and normalize every image ([`preprocess.py`](../image-classification/preprocess.py)) | `swaleio/python-3-13` | `cpu-4` | | Train with one output and a mean-squared-error loss ([`train.py`](../image-classification/train.py) `--regression`) | `swaleio/transformers` | `a100-1` | | Predict the eval split ([`predict.py`](../image-classification/predict.py)) | `swaleio/transformers` | `a100-1` | | Compute mean absolute error, root mean squared error, correlation and exact counts | `swaleio/duckdb` | `cpu-4` | diff --git a/workflows/image-regression/workflow.yaml b/workflows/image-regression/workflow.yaml index 61f0ccf..25782ad 100644 --- a/workflows/image-regression/workflow.yaml +++ b/workflows/image-regression/workflow.yaml @@ -67,7 +67,7 @@ blocks: FROM '${{env.WORKFLOW_STORAGE}}/eval.parquet'; check_images: - name: Check, resize and normalise the images + name: Check, resize and normalize the images uses: swaleio/python-3-13 start_on: - fetch_scripts diff --git a/workflows/kto-alignment/workflow.yaml b/workflows/kto-alignment/workflow.yaml index 06cfa7e..cc8a411 100644 --- a/workflows/kto-alignment/workflow.yaml +++ b/workflows/kto-alignment/workflow.yaml @@ -1,5 +1,5 @@ name: Align a model with KTO -description: Aligns a chat model to answers labelled good or bad with TRL's KTO, then measures its win rate against the base model on held-out prompts with a judge model. +description: Aligns a chat model to answers labeled good or bad with TRL's KTO, then measures its win rate against the base model on held-out prompts with a judge model. compute_type: cpu-4 inputs: @@ -129,7 +129,7 @@ blocks: args: sql: | -- Each pair is judged with the aligned answer first on even rows and second on odd - -- rows, so a judge that prefers one position does not favour either model. + -- rows, so a judge that prefers one position does not favor either model. CREATE TABLE pairs AS SELECT p.custom_id, p.prompt, b.response.body.choices[1].message.content AS base, diff --git a/workflows/label-text/README.md b/workflows/label-text/README.md index 091a70c..7275cd7 100644 --- a/workflows/label-text/README.md +++ b/workflows/label-text/README.md @@ -9,13 +9,13 @@ and prints a confusion table. | Step | Task definition | Compute | |------|-----------------|---------| | Fetch the model | `swaleio/hf-download` | `cpu-4` | -| Write one labelling request per text | `swaleio/duckdb` | `cpu-4` | +| Write one labeling request per text | `swaleio/duckdb` | `cpu-4` | | Label | `swaleio/vllm-batch` | `a100-1` | | Join labels to texts, 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 Hugging Face Hub, when `hub_repo` is set | `swaleio/hf-upload` | `cpu-4` | -Every step is its own task; only labelling holds a GPU. +Every step is its own task; only labeling holds a GPU. ## Inputs diff --git a/workflows/label-text/workflow.yaml b/workflows/label-text/workflow.yaml index fa8a329..de01455 100644 --- a/workflows/label-text/workflow.yaml +++ b/workflows/label-text/workflow.yaml @@ -83,13 +83,13 @@ blocks: - label args: sql: | - CREATE TABLE labelled AS + CREATE TABLE labeled AS SELECT t.*, trim(r.response.body.choices[1].message.content) AS llm_label FROM '${{env.WORKFLOW_STORAGE}}/texts.parquet' t JOIN read_json('${{env.WORKFLOW_STORAGE}}/results.jsonl') r USING (custom_id) ORDER BY custom_id; - SELECT llm_label, count(*) AS texts FROM labelled GROUP BY ALL ORDER BY texts DESC; - COPY labelled TO '${{env.WORKFLOW_STORAGE}}/labels.parquet' (FORMAT parquet); + SELECT llm_label, count(*) AS texts FROM labeled GROUP BY ALL ORDER BY texts DESC; + COPY labeled TO '${{env.WORKFLOW_STORAGE}}/labels.parquet' (FORMAT parquet); compare: name: Compare when existing labels are given diff --git a/workflows/llm-as-a-judge/README.md b/workflows/llm-as-a-judge/README.md index 238047e..630cd0c 100644 --- a/workflows/llm-as-a-judge/README.md +++ b/workflows/llm-as-a-judge/README.md @@ -12,7 +12,7 @@ Run it on two models to compare them, or before and after a fine-tune. | Answer | `swaleio/vllm-batch` | `a100-1` | | Join answers to prompts, write one judge request per answer | `swaleio/duckdb` | `cpu-4` | | Judge | `swaleio/vllm-batch` | `a100-1` | -| Summarise the scores | `swaleio/duckdb` | `cpu-4` | +| Summarize the scores | `swaleio/duckdb` | `cpu-4` | Every step is its own task. vLLM's structured outputs hold the judge to a number from 1 to 10, and its thinking is turned off, so it answers at once. diff --git a/workflows/llm-as-a-judge/workflow.yaml b/workflows/llm-as-a-judge/workflow.yaml index 6eab657..6639f08 100644 --- a/workflows/llm-as-a-judge/workflow.yaml +++ b/workflows/llm-as-a-judge/workflow.yaml @@ -1,5 +1,5 @@ name: Score answers with an LLM as a judge -description: Answers a set of prompts with one model, has a stronger judge model score every answer from 1 to 10, and summarises the scores. +description: Answers a set of prompts with one model, has a stronger judge model score every answer from 1 to 10, and summarizes the scores. compute_type: cpu-4 inputs: @@ -109,8 +109,8 @@ blocks: input_file: ${{env.WORKFLOW_STORAGE}}/judge-requests.jsonl output_file: ${{env.WORKFLOW_STORAGE}}/scores.jsonl - summarise: - name: Summarise scores + summarize: + name: Summarize scores uses: swaleio/duckdb start_on: - judge diff --git a/workflows/merge-models/README.md b/workflows/merge-models/README.md index 23c42a2..e8c5b30 100644 --- a/workflows/merge-models/README.md +++ b/workflows/merge-models/README.md @@ -9,7 +9,7 @@ NuMind's extraction model, both fine-tuned from Qwen2.5-0.5B. Both fine-tunes must come from `base` itself. A model built by long further pretraining has moved too far from it: Qwen2.5-Coder-0.5B-Instruct, merged -with Qwen2.5-0.5B-Instruct this way, answered maths questions with strings of +with Qwen2.5-0.5B-Instruct this way, answered math questions with strings of zeros. | Step | Task definition | Compute | diff --git a/workflows/retrieval-index/workflow.yaml b/workflows/retrieval-index/workflow.yaml index dbc44a8..410fe40 100644 --- a/workflows/retrieval-index/workflow.yaml +++ b/workflows/retrieval-index/workflow.yaml @@ -11,7 +11,7 @@ inputs: default: BAAI/bge-small-en-v1.5 query: description: A question to test the index with. - default: How does Docling recognise the structure of tables? + default: How does Docling recognize the structure of tables? hub_repo: description: Hugging Face dataset repo to upload the index to, as namespace/name. Leave empty to keep it on the workspace only. default: "" diff --git a/workflows/rloo-math/README.md b/workflows/rloo-math/README.md index ed835f8..528e8f5 100644 --- a/workflows/rloo-math/README.md +++ b/workflows/rloo-math/README.md @@ -1,8 +1,8 @@ -# Train maths reasoning with RLOO +# Train math reasoning with RLOO -Trains a model to solve maths word problems with REINFORCE leave-one-out. For each question the model writes several answers; +Trains a model to solve math word problems with REINFORCE leave-one-out. For each question the model writes several answers; TRL's `accuracy_reward` gives 1 to the answers whose final result matches the -reference, checked with `math-verify`, and the model learns to favour them. The +reference, checked with `math-verify`, and the model learns to favor them. The base model and the trained model are both scored on GSM8K's test split. | Step | Task definition | Compute | diff --git a/workflows/rloo-math/workflow.yaml b/workflows/rloo-math/workflow.yaml index e6d5d89..3852e74 100644 --- a/workflows/rloo-math/workflow.yaml +++ b/workflows/rloo-math/workflow.yaml @@ -1,5 +1,5 @@ -name: Train maths reasoning with RLOO -description: Trains a model on maths word problems with TRL's RLOO, rewarding answers that match the reference, and compares its GSM8K score before and after. +name: Train math reasoning with RLOO +description: Trains a model on math word problems with TRL's RLOO, rewarding answers that match the reference, and compares its GSM8K score before and after. compute_type: cpu-4 inputs: diff --git a/workflows/score-gguf/README.md b/workflows/score-gguf/README.md index a5a9229..c8659ac 100644 --- a/workflows/score-gguf/README.md +++ b/workflows/score-gguf/README.md @@ -2,7 +2,7 @@ Measures how well a quantized model answers, and how fast, in the exact GGUF file you would ship. llama.cpp serves the model on a CPU compute type, several -client tasks answer GSM8K maths questions through that one server at the same +client tasks answer GSM8K math questions through that one server at the same time, and the last step checks each answer against the reference and reports the accuracy and the tokens per second. @@ -22,7 +22,7 @@ library. The server needs no GPU; give it `a100-1` instead and llama.cpp offloads the model to the GPU. The model is asked to reason step by step and put its final answer within -`\boxed{}`, the form Qwen's models are trained to answer maths in. The score +`\boxed{}`, the form Qwen's models are trained to answer math in. The score takes the number in its last `\boxed{}`, or the last number in its reply when it has none, and the report also says how often it boxed its answer. diff --git a/workflows/score-gguf/workflow.yaml b/workflows/score-gguf/workflow.yaml index 220fd5b..02d1412 100644 --- a/workflows/score-gguf/workflow.yaml +++ b/workflows/score-gguf/workflow.yaml @@ -1,5 +1,5 @@ name: Score a GGUF model on a CPU -description: Serves a quantized GGUF model with llama.cpp on a CPU, has parallel client tasks answer GSM8K maths questions through it, and reports accuracy and speed. +description: Serves a quantized GGUF model with llama.cpp on a CPU, has parallel client tasks answer GSM8K math questions through it, and reports accuracy and speed. compute_type: cpu-4 inputs: diff --git a/workflows/sentence-embeddings/workflow.yaml b/workflows/sentence-embeddings/workflow.yaml index b5cbb04..06333f2 100644 --- a/workflows/sentence-embeddings/workflow.yaml +++ b/workflows/sentence-embeddings/workflow.yaml @@ -133,7 +133,7 @@ blocks: args: sql: | -- Each query's own answer is the one document that counts as relevant. The - -- vectors are normalised, so their dot product is their cosine similarity. + -- vectors are normalized, so their dot product is their cosine similarity. CREATE TABLE vectors AS SELECT 'base' AS model, * FROM '${{env.WORKFLOW_STORAGE}}/vectors-base.parquet' UNION ALL diff --git a/workflows/setfit-classifier/README.md b/workflows/setfit-classifier/README.md index 347a2c0..75cfe48 100644 --- a/workflows/setfit-classifier/README.md +++ b/workflows/setfit-classifier/README.md @@ -1,8 +1,8 @@ # Train a few-shot classifier with SetFit -Trains a text classifier from a few labelled examples per class with SetFit: +Trains a text classifier from a few labeled examples per class with SetFit: it fine-tunes a sentence-embedding model on pairs of the examples, then fits a -classification head on the embeddings. Useful when labelling hundreds of +classification head on the embeddings. Useful when labeling hundreds of examples is not an option. The prediction and the scores are separate steps. | Step | Task definition | Compute | diff --git a/workflows/setfit-classifier/train.py b/workflows/setfit-classifier/train.py index 906e383..493b1a8 100644 --- a/workflows/setfit-classifier/train.py +++ b/workflows/setfit-classifier/train.py @@ -1,7 +1,7 @@ """Trains a SetFit few-shot classifier, on a GPU. SetFit first fine-tunes a sentence-embedding model on pairs drawn from the few -labelled examples, then fits a classification head on the embeddings. Both +labeled examples, then fits a classification head on the embeddings. Both happen inside one SetFit Trainer.train() call, which is why training stays a single script. """ diff --git a/workflows/summarization/README.md b/workflows/summarization/README.md index 81ad617..88fe36f 100644 --- a/workflows/summarization/README.md +++ b/workflows/summarization/README.md @@ -1,6 +1,6 @@ # Fine-tune a model to write news summaries -Fine-tunes a sequence-to-sequence model, such as Flan-T5, to summarise news +Fine-tunes a sequence-to-sequence model, such as Flan-T5, to summarize news articles, then generates a summary of every held-out article and scores the summaries with ROUGE. Generating needs a GPU; scoring does not, so the two are separate tasks. diff --git a/workflows/summarization/workflow.yaml b/workflows/summarization/workflow.yaml index 3eeb12f..7821e34 100644 --- a/workflows/summarization/workflow.yaml +++ b/workflows/summarization/workflow.yaml @@ -1,5 +1,5 @@ name: Fine-tune a model to write news summaries -description: Fine-tunes a sequence-to-sequence model to summarise news articles, with tokenizing on a CPU, training and generation on a GPU, and ROUGE computed on a CPU. +description: Fine-tunes a sequence-to-sequence model to summarize news articles, with tokenizing on a CPU, training and generation on a GPU, and ROUGE computed on a CPU. compute_type: cpu-4 inputs: @@ -13,7 +13,7 @@ inputs: description: Parquet file or glob of evaluation articles, as a DuckDB path. default: hf://datasets/abisee/cnn_dailymail/3.0.0/validation-00000-of-00001.parquet source_column: - description: Column holding each text to summarise. + description: Column holding each text to summarize. default: article target_column: description: Column holding each reference summary. diff --git a/workflows/synthetic-reasoning-data/workflow.yaml b/workflows/synthetic-reasoning-data/workflow.yaml index c5b1104..076bfde 100644 --- a/workflows/synthetic-reasoning-data/workflow.yaml +++ b/workflows/synthetic-reasoning-data/workflow.yaml @@ -1,5 +1,5 @@ name: Generate synthetic chain-of-thought data -description: Has a reasoning model solve maths questions step by step and a judge model check each answer, and keeps the correct solutions as a fine-tuning dataset. +description: Has a reasoning model solve math questions step by step and a judge model check each answer, and keeps the correct solutions as a fine-tuning dataset. compute_type: cpu-4 inputs: diff --git a/workflows/token-classification/README.md b/workflows/token-classification/README.md index 0157155..39bfac5 100644 --- a/workflows/token-classification/README.md +++ b/workflows/token-classification/README.md @@ -3,7 +3,7 @@ Fine-tunes an encoder model to tag named entities, word by word, and scores it the way named-entity recognition is usually scored: an entity counts only when its type and its exact span of words are right. The default data is WIESP 2022, -entities such as instruments, missions and organisations in astrophysics +entities such as instruments, missions and organizations in astrophysics papers. | Step | Task definition | Compute | diff --git a/workflows/translation/README.md b/workflows/translation/README.md index 8399722..1f923ba 100644 --- a/workflows/translation/README.md +++ b/workflows/translation/README.md @@ -16,7 +16,7 @@ recent and carefully translated set. | Score BLEU and chrF ([`score.py`](../summarization/score.py)) | `swaleio/python-3-13` | `cpu-4` | | Upload the model, when `hub_repo` is set | `swaleio/hf-upload` | `cpu-4` | -The scripts are the [summarisation](../summarization) workflow's. +The scripts are the [summarization](../summarization) workflow's. **What stays one script:** the training loop, which holds the model, the optimizer and the batches together on one GPU. diff --git a/workflows/vlm-finetune/prepare.py b/workflows/vlm-finetune/prepare.py index cff8f38..9888b2c 100644 --- a/workflows/vlm-finetune/prepare.py +++ b/workflows/vlm-finetune/prepare.py @@ -1,4 +1,4 @@ -"""Turns a labelled image dataset into chat-format training rows for a vision-language model, on a CPU. +"""Turns a labeled image dataset into chat-format training rows for a vision-language model, on a CPU. Each row becomes a prompt, a user turn holding the image and a question, and a completion, an assistant turn holding the answer: the image's label. With prompt