Transformer Lab SDK
The Transformer Lab Python SDK provides a way for ML scripts to integrate with Transformer Lab.
Install
pip install transformerlab
Usage
from lab import lab
# Initialize with experiment ID
lab.init("my-experiment")
lab.log("Job initiated")
config_artifact_path = lab.save_artifact(<config_file>, "training_config.json")
lab.log(f"Saved training config: {config_artifact_path}")
lab.update_progress(1)
...
lab.update_progress(99)
model_path = lab.save_model(<training_output_dir>, name="trained_model")
lab.log("Saved model file to {model_path}")
lab.finish("Training completed successfully")
Reporting metrics
Pass a dict of named metrics to lab.finish(score=...). The dict shape is required —
metrics are stored under job_data.score and surfaced by lab job list (Score column)
and lab job info, and read by sweep flows for optimization.
lab.finish(message="Done!") # success, no score
lab.finish(message="Done!", score={"accuracy": 0.78}) # success with one metric
lab.finish(score={"accuracy": 0.78, "f1": 0.83}) # multiple metrics
Do not pass a scalar (e.g. lab.finish(score=0.78)) — wrap it in a dict instead:
lab.finish(score={"score": 0.78}).
Sample scripts can be found at https://github.com/transformerlab/transformerlab-app/tree/main/lab-sdk/scripts/examples
Development
The code for this can be found in the lab-sdk directory of
https://github.com/transformerlab/transformerlab-app
To develop locally in editable mode and run automated tests:
cd lab-sdk
uv venv
uv pip install -e .
uv run pytest # Run tests
Metadata
Release files for transformerlab 0.1.46
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| transformerlab-0.1.46.tar.gz | 117.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| transformerlab-0.1.46-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 216.0 kB
Release files / transformerlab-0.1.46.tar.gz
| Download URL | transformerlab-0.1.46.tar.gz |
|---|---|
| Size | 117.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d21279a55d865ec62d12f63a09cd1c82b7f954f91c94220478f9379f95a94155
|
|
BLAKE2b-256 checksum How to use checksums |
3d8d25f97a089a0c2e49125efe57652a35da16b16c46c3d9a1a9261e5d2f630a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / transformerlab-0.1.46-py3-none-any.whl
| Download URL | transformerlab-0.1.46-py3-none-any.whl |
|---|---|
| Size | 98.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
025808fd62ceb35aec0b2d6efe0de0d9118d8dd8e7e0bf0732a001081f446c14
|
|
BLAKE2b-256 checksum How to use checksums |
3dd48909553ae8551c5ef38ce5ea193f44afbcbd61ab081c17fdb2944c8c4038
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|