Training Projects

Access training projects through client.training_projects in the Datature Vi SDK.

Training projects organize related flows and runs into logical groups for tracking training experiments. Each training project has a type (phrase grounding, VQA, or freeform) that determines the annotation format and model architecture options available.

Before You Start

Methods

list()

List all training projects in your organization.

projects = client.training_projects.list()

for project in projects.items:
    print(f"{project.spec.name}: {project.training_project_id}")
from vi.api.types import PaginationParams

projects = client.training_projects.list(
    pagination=PaginationParams(page_size=50)
)

for page in projects:
    for project in page.items:
        print(f"{project.spec.name}: {project.spec.type}")
all_projects = list(client.training_projects.list().all_items())
print(f"Total projects: {len(all_projects)}")

Parameters

Name
Type
Description
Required
Default

Returns: PaginatedResponse[TrainingProject]


get()

Get a specific training project by ID.

project = client.training_projects.get(
    training_project_id="project_abc123"
)

print(f"Name: {project.spec.name}")
print(f"Type: {project.spec.type}")
project = client.training_projects.get(
    training_project_id="project_abc123"
)
project.info()  # Prints formatted project summary
project = client.training_projects.get(
    training_project_id="project_abc123"
)

print(f"Runs: {len(project.status.runs)}")
print(f"Flows: {len(project.status.flows)}")

Parameters

Name
Type
Description
Required
Default

Returns: TrainingProject


create()

Create a new training project.

project = client.training_projects.create(
    spec={"name": "My Project", "type": "vqa"}
)

print(f"Created: {project.training_project_id}")
project = client.training_projects.create(
    spec={"name": "My Project", "type": "phrase-grounding"},
    training_project_id="my-custom-id"
)
project = client.training_projects.create(
    spec={"name": "My Project", "type": "freeform"},
    metadata={"environment": "production"}
)

Parameters

Name
Type
Description
Required
Default

Returns: TrainingProject


update()

Update an existing training project. Uses PATCH semantics: only provided fields are modified. The project type cannot be changed after creation.

project = client.training_projects.update(
    training_project_id="project_abc123",
    spec={"name": "Updated Name"}
)
project = client.training_projects.update(
    training_project_id="project_abc123",
    spec={"description": "New description"}
)
project = client.training_projects.update(
    training_project_id="project_abc123",
    metadata={"environment": "staging"}
)

Parameters

Name
Type
Description
Required
Default

Returns: TrainingProject


delete()

Delete a training project permanently.

deleted = client.training_projects.delete(
    training_project_id="project_abc123"
)
print(f"Deleted: {deleted.id}")
project = client.training_projects.get(
    training_project_id="project_abc123"
)
print(f"About to delete: {project.spec.name}")
print(f"  Runs: {len(project.status.runs)}")

confirm = input("Delete? (yes/no): ")
if confirm.lower() == "yes":
    client.training_projects.delete(
        training_project_id="project_abc123"
    )
    print("Deleted.")

Parameters

Name
Type
Description
Required
Default

Returns: DeletedResource


get_aggregation_insights()

Get aggregation insights for a training project, including hyperparameters and metrics across all runs.

insights = client.training_projects.get_aggregation_insights(
    training_project_id="project_abc123"
)

if insights.payload:
    for run_id, data in insights.payload.results.items():
        print(f"Run {run_id}: {data}")

Parameters

Name
Type
Description
Required
Default

Returns: AggregationInsightsResult


generate_aggregation_insights()

Trigger generation of aggregation insights for a training project. This is an asynchronous operation. Use get_aggregation_insights() to check the status and retrieve results.

client.training_projects.generate_aggregation_insights(
    training_project_id="project_abc123"
)

# Check status later
insights = client.training_projects.get_aggregation_insights(
    training_project_id="project_abc123"
)

if insights.pending_operation:
    print(f"Status: {insights.pending_operation.status}")

Parameters

Name
Type
Description
Required
Default

Returns: None


dry_run_create()

Validate whether a training project can be created with the given ID and name without actually creating it.

result = client.training_projects.dry_run_create(
    training_project_id="my-project",
    name="My Project"
)

if result.errors:
    for error in result.errors:
        print(f"Conflict: {error.kind}")
else:
    print("No conflicts, safe to create")

Parameters

Name
Type
Description
Required
Default

Returns: DryRunResponse


Response types

TrainingProject

from vi.api.resources.training_projects.responses import TrainingProject

Properties

Name
Type
Description
Required
Default

Methods: info() → prints a formatted project summary.


TrainingProjectSpec

from vi.api.resources.training_projects.responses import TrainingProjectSpec

Properties

Name
Type
Description
Required
Default

TrainingProjectStatus

from vi.api.resources.training_projects.responses import TrainingProjectStatus

Properties

Name
Type
Description
Required
Default

AggregationInsightsResult

from vi.api.resources.training_projects.responses import AggregationInsightsResult

Properties

Name
Type
Description
Required
Default

AggregationInsightsPayload

from vi.api.resources.training_projects.responses import AggregationInsightsPayload

Properties

Name
Type
Description
Required
Default

PendingOperation

from vi.api.resources.training_projects.responses import PendingOperation

Properties

Name
Type
Description
Required
Default

DryRunResponse

from vi.api.resources.training_projects.responses import DryRunResponse

Properties

Name
Type
Description
Required
Default

DryRunError

from vi.api.resources.training_projects.responses import DryRunError

Properties

Name
Type
Description
Required
Default

Related resources


Did this page help you?