> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tracebloc.io/llms.txt
> Use this file to discover all available pages before exploring further.

# tracebloc Python SDK

> Python library for uploading models, linking them with datasets, configuring training parameters, and launching experiments on the tracebloc platform.

`tracebloc` is a Python library for uploading models, linking them with datasets, configuring training parameters, and launching experiments on the tracebloc platform.

> [!NOTE]
>
> Install and import the SDK as `tracebloc`: `pip install tracebloc`, then `from tracebloc import User`. The package took this name in 0.8.0, so a notebook written for an older release should switch its install line and imports to `tracebloc`.

## Installation

Requires Python 3.11 or later (`>=3.11,<3.15`); 3.11 or 3.12 is recommended.

Pick the extra that matches your ML framework — the default install ships the core SDK only (\~140 MB, \~30 sec) instead of every framework (\~8 GB):

```bash theme={null}
pip install "tracebloc[pytorch]>=1.2.47"                       # most users
# pip install "tracebloc[sklearn]>=1.2.47"                     # scikit-learn, incl. XGBoost / CatBoost / LightGBM
# pip install "tracebloc[xgboost]>=1.2.47"                     # one boosting backend only (or: catboost, lightgbm)
# pip install "tracebloc[lifelines,scikit-survival]>=1.2.47"   # survival analysis
# pip install "tracebloc[all]>=1.2.47"                         # pytorch + sklearn + lifelines + scikit-survival
# pip install "tracebloc[training]>=1.2.82"                    # the training versions, to convert your model (Python 3.11–3.13)
```

The `training` extra installs exactly the versions of `torch`, `transformers`, `timm`, `scikit-learn` and the other libraries that training runs with, which is what converting a model needs. It supports Python 3.11, 3.12 and 3.13. Install it in a fresh virtual environment; [Bring your model](https://docs.tracebloc.io/join-use-case/bring-your-model.md) shows when you need it.

> [!NOTE]
>
> **There is no `tensorflow` extra**, and `all` does not include TensorFlow — it
> resolves to `pytorch`, `sklearn`, `lifelines` and `scikit-survival`. The
> published extras are exactly: `pytorch`, `sklearn`, `xgboost`, `catboost`,
> `lightgbm`, `lifelines`, `scikit-survival`, `all`, `training` and `dev`.
>
> The umbrella `[boosting]` and `[survival]` extras were removed in 0.10.0, along
> with `[huggingface]` (the Hugging Face stack now ships inside `[pytorch]`).
>
> This matters because of how pip behaves: **an unknown extra is a warning, not an
> error, and pip still exits 0**. Asking for one that does not exist therefore
> appears to succeed while installing the core SDK only, and the failure surfaces
> much later as an `ImportError`.

## Key Features

* Upload model files and pretrained weights
* Link models with datasets from your use cases
* Configure training parameters (epochs, optimizer, learning rate, augmentation, callbacks)
* Review the experiment's settings before starting
* Launch remote training on secure infrastructure

## Quick Start

```python theme={null}
from tracebloc import User

# 1. Log in to your tracebloc account
user = User()  # prompts for email and password

# 2. Upload a model file (must be in your current directory or provide a path)
user.upload_model(model_name="densenet.py")

# To upload with pretrained weights (weights file must be in the same directory):
# user.upload_model(model_name="densenet.py", weights=True)

# 3. Link model with a dataset from your use case
#    Find the Dataset ID on your use case page at ai.tracebloc.io
training_plan = user.link_model_dataset(dataset_id="YOUR_DATASET_ID")

# 4. Configure training parameters
training_plan.experiment_name("My first experiment")
training_plan.epochs(10)
training_plan.optimizer("adam")
training_plan.learning_rate({"type": "constant", "value": 0.001})
training_plan.validation_split(0.2)

# 5. Review the experiment's settings
training_plan.get_training_plan()

# 6. Start training
training_plan.start()

# 7. Log out when done
user.logout()
```

## Model Zoo

Use a ready-made model from the [tracebloc model zoo](https://github.com/tracebloc/model-zoo) or bring your own. Supported tasks: image classification, object detection, keypoint detection, semantic segmentation, text classification, sentence pair classification, token classification, masked language modeling, causal language modeling, seq2seq, embeddings, tabular classification and regression, time series classification and forecasting, and time-to-event prediction.

Many model zoo templates are pretrained models, but the repository ships only their code. Uploaded without weights, they train from random weights. Fetch the pretrained seed weights into the model file's directory first, then upload with `weights=True`:

```python theme={null}
model_dir = "model-zoo/model_zoo/<task>/pytorch"

# Writes <template>_weights.pkl next to <template>.py
user.fetch_seed_weights("<template>", directory=model_dir)
user.upload_model(model_name=f"{model_dir}/<template>.py", weights=True)
```

For a template without pretrained weights, `fetch_seed_weights` raises an error saying so. See [Start training](https://docs.tracebloc.io/join-use-case/start-training.md#upload) for details.

## Quickstart notebook

To train from your own notebook, run the step-by-step [quickstart notebook](https://github.com/tracebloc/quickstart/blob/main/notebooks/traceblocTrainingGuide.ipynb) on your machine. [Start training](https://docs.tracebloc.io/join-use-case/start-training.md) walks you through it.

## Next Steps

* [Start training](https://docs.tracebloc.io/join-use-case/start-training.md) — detailed walkthrough of the training workflow
* [Hyperparameters](https://docs.tracebloc.io/join-use-case/hyperparameters.md) — full reference for all training configuration options
* [FAQs](https://docs.tracebloc.io/tools-help/faqs.md)
* [Key terms](https://docs.tracebloc.io/tools-help/key-terms.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.