Skip to content

Models

All models are Pydantic BaseModel subclasses.


TrainingConfig

Configuration for an RL training run.

from canard.models import TrainingConfig

Fields

Field Type Default Description
task_name str required Gym environment ID
num_envs int 1000 Parallel environments (1–10,000)
max_iterations int 1500 Training iterations (1–100,000)
video_enabled bool False Record training videos
video_interval int 2000 Steps between recordings
seed int? None Random seed
checkpoint_url str? None S3 URL to resume from
code_url str? None GitHub repo with environment
code_ref str? None Git ref (branch/tag/commit)
gpu_count int 1 GPUs: 1, 2, 4, or 8

PPO Hyperparameters

Field Type Description
learning_rate float? PPO learning rate
clip_param float? PPO clip (0–1)
entropy_coef float? Entropy regularization
gamma float? Discount factor (0–1)
lam float? GAE lambda (0–1)
num_learning_epochs int? Epochs per PPO update
num_mini_batches int? Mini-batches per epoch
desired_kl float? Target KL divergence
max_grad_norm float? Gradient clipping
schedule str? LR schedule ("adaptive" or "fixed")

Network Architecture

Field Type Description
actor_hidden_dims list[int]? Actor MLP hidden layer sizes
critic_hidden_dims list[int]? Critic MLP hidden layer sizes
activation str? Activation function (e.g., "relu")
init_noise_std float? Initial exploration noise
reward_weights dict[str, float]? Reward function weights

Methods

estimate_cost

config.estimate_cost(total_tasks: int = 1) -> dict

Returns a dict with:

Key Type Description
iter_sec float Seconds per iteration
task_time_hr float Hours per task
task_cost float Cost per task ($)
total_cost float Total cost ($)
wall_time_hr float Wall time (parallel)
hourly_rate float $/hr for GPU config

Run

A training run with one or more tasks.

Field Type Description
id int Numeric ID
slug str URL-safe slug (run_ + 8 chars)
name str Human-readable name
user_id str Owner
config RunConfig Run configuration
status str queued, running, completed, failed
num_tasks int Total tasks
completed_tasks int Completed tasks
tensorboard_url str TensorBoard URL
created_at datetime Creation time
updated_at datetime Last update

Properties

Property Type Description
dashboard_url str Dashboard link
is_complete bool Status == completed
is_failed bool Status == failed
is_running bool Status == running
progress float Fraction complete (0.0–1.0)

RunConfig

Field Type Default Description
mode str "physics" "physics" or "training"
training_config TrainingConfig? None Training configuration
sweep_configs list[SweepConfig]? None Sweep parameters
num_samples int? None Parameter combinations
steps int 1000 Sim steps per task

Task

An individual simulation task within a run.

Field Type Description
id int Task ID
run_id int Parent run ID
params dict Task parameters
status str queued, running, completed, failed
worker_id str? Executing worker
s3_key str? S3 results key
metrics TaskMetrics? Results (if complete)
error_message str? Error (if failed)
created_at datetime Creation time
completed_at datetime? Completion time
progress_percent float 0–100

TaskMetrics

Field Type Description
avg_fps float Average physics FPS
total_reward float Total reward
collision_count int Collisions
episode_duration float Duration (seconds)
success bool Succeeded

RunMetrics

Aggregated metrics across all tasks.

Field Type Description
avg_physics_fps float Average FPS
success_rate float Success percentage
avg_episode_reward float Average reward
total_collisions int Total collisions
completed_tasks int Completed count
total_tasks int Total count
mode str "physics" or "training"
training TrainingMetrics? Training-specific metrics

TrainingMetrics

Field Type Description
mean_reward float Current mean reward
mean_episode_length float Avg episode length
current_iteration int Current iteration
max_iterations int Total iterations
progress_percent float Training progress %
reward_history list[dict] Historical rewards

QueueStatus

Field Type Description
queued int Tasks waiting
running int Tasks running
completed int Tasks completed
failed int Tasks failed
active_workers int Active GPU workers

SweepConfig

Field Type Description
parameter str Parameter name
values list Values to sweep