ARTI

ARTI guides

Train with your own model and loss

Define a native task once. Connect its data, parameter ownership and scalar objective to the shared training session.

On this page

Choose the training entrance

Use the entrance that matches the object your application already owns. A task recipe adds the complete local run lifecycle; the shared session is also available directly.

ApplicationEntranceWhat you supply
Attached host modelmodel.arti.trainerConfigured layer and host loss
Native PyTorch modelarti.trainerModel and objective callable
Complete custom taskTaskRecipeFactory, data, objective, prediction and evaluation

Separate task semantics from resource locations

TaskRecipeConfig names the installed factory. Put the task’s mathematical choices in options and relocatable paths in resources. The factory receives the configuration and a mode; train returns TaskRecipe, while predict returns TaskPredictor without building an optimizer.

python
import arti

config = arti.TaskRecipeConfig(
    task="my-task",
    factory="my_package.tasks:build_task",
    options={"input_shape": [32, 32, 3], "loss_profile": "original-v1"},
    resources={"data": "/current/location/dataset.jsonl"},
    training=arti.ARTITrainingConfig(device="cpu", steps=100),
)
recipe = arti.TaskRecipe.from_config(config)
result = recipe.fit(run=arti.ARTITrainingRunConfig(output_dir="outputs/run"))

Keep the actual task objective

objective(model, batch) returns a differentiable scalar Tensor. The shared engine performs backward, accumulation and optimizer steps. The application retains decoding, collation, labels and metric meaning.

ContractApplication responsibility
objective_idVersion the meaning of the loss
training_weight(batch)Declare normalization units for unequal batches
evaluation_weightPreserve native-loss evaluation units
dataset_manifest.sha256Compute and verify the actual data identity

Make execution, optimization and saved state explicit

TrainingBinding(model, parameters=..., state_module=...) separates the executed object, selected trainable parameter owners and the tensor state needed for recovery. Include every supported buffer and resource required to reconstruct the task. An excluded immutable host must be reconstructed by the pinned factory.

Start with the installed file tutorial

The files template includes model code, data, configuration and workflow.py. Generating and checking the task project does not invoke the training factory. Continue with its TUTORIAL.md to adapt the objective and callbacks.

Terminal
python -m arti task init my-task --name "my task" --template files
cd my-task
python -m arti task check project.json
python -m arti task status project.json
python -m arti task explain project.json