Train on your annotated data¶
cc4q.train fine-tunes one of the two released quantum classifiers
with the HF Trainer, using the same recipe as the released models —
starting from bert-base-uncased by default, or warm-started from the
released checkpoints via base_model="released". Run
cc4q download-models --with-base once to cache bert-base-uncased
locally and cold-start fine-tuning also works offline (the Docker image
already ships all three models).
Data contract¶
JSONL, one record per line:
task |
text column |
label column |
|---|---|---|
|
|
int |
|
|
int |
The label indices follow the category order documented in
Data contracts. Violations raise a ValueError that names the
problem rows and shows an example record.
import cc4q
cc4q.train("quantum_related", "my_annotations.jsonl",
output_dir="out/my_qr_classifier",
base_model="bert-base-uncased",
batch_size=32, epochs=30)
Validate a training file without training:
cc4q train --task quantum_related --data my_annotations.jsonl \
--output-dir out/x --dry-run
The train-ready export of the annotation UI already satisfies this
contract: annotate first (see The annotation loop), then train on the exported
annotations.jsonl (add an id/text column mapping via the schema if
your text column is not the task’s default).