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.
- Vi SDK installed with authentication configured
- A secret key for API authentication
- Familiarity with Vi SDK basics
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)}")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 summaryproject = client.training_projects.get(
training_project_id="project_abc123"
)
print(f"Runs: {len(project.status.runs)}")
print(f"Flows: {len(project.status.flows)}")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"}
)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"}
)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.")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}")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}")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")Returns: DryRunResponse
Response types
TrainingProject
from vi.api.resources.training_projects.responses import TrainingProjectMethods: info() → prints a formatted project summary.
TrainingProjectSpec
from vi.api.resources.training_projects.responses import TrainingProjectSpecTrainingProjectStatus
from vi.api.resources.training_projects.responses import TrainingProjectStatusAggregationInsightsResult
from vi.api.resources.training_projects.responses import AggregationInsightsResultAggregationInsightsPayload
from vi.api.resources.training_projects.responses import AggregationInsightsPayloadPendingOperation
from vi.api.resources.training_projects.responses import PendingOperationDryRunResponse
from vi.api.resources.training_projects.responses import DryRunResponseDryRunError
from vi.api.resources.training_projects.responses import DryRunErrorRelated resources
Updated about 1 month ago
