upload_task_templates
This script takes a config of task templates and uploads them to bitfount hub.
The config also contains paths to any custom models and weights that are used in the task templates. If the models or weights have changed since the last upload, the models and weights are uploaded to bitfount hub and the task templates are updated to use the new versions of the models and weights. Finally, there is also the option to archive task templates that are no longer used.
Example dev usage:
```bash
BITFOUNT_ENVIRONMENT=dev python -m bitfount.runners.upload_task_templates \\
task_templates/config-staging.yaml -u <username> -p <password>
Example production usage:
python -m bitfount.runners.upload_task_templates \\
task_templates/config-production.yaml -u <username> -p <password>
Module
Functions
main
def main( config_file: os.PathLike, username: str = 'bitfount', password: Optional[str] = None,) ‑> None:
Uploads models, weights and task templates to bitfount.
Iterates over the models in the config file and uploads them to bitfount if the code hash or weights are different from the latest version on bitfount. Once the models are updated, the task templates are updated to use the latest versions of the models and the task templates are themselves uploaded to bitfount.
Arguments
config_file
: The path to the YAML config.username
: The username for the model owner. Defaults to 'bitfount'.password
: The password for the model owner if using ExternallyManagedJWTHandler for authentication. Defaults to None.
Classes
BasicTaskTemplateConfig
class BasicTaskTemplateConfig(**data: Any):
Base task template config model for static and runtime type checking.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.
self
is explicitly positional-only to allow self
as a field name.
Ancestors
- pydantic.main.BaseModel
Subclasses
ModelConfig
class ModelConfig(**data: Any):
Model config model for static and runtime type checking.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.
self
is explicitly positional-only to allow self
as a field name.
Ancestors
- pydantic.main.BaseModel
Variables
- static
model_computed_fields
- static
model_config
- static
model_fields
- static
model_file : str
- static
private : bool
- static
weights_file : Optional[str]
TaskTemplateConfig
class TaskTemplateConfig(**data: Any):
Model config model for static and runtime type checking.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.
self
is explicitly positional-only to allow self
as a field name.
Ancestors
- BasicTaskTemplateConfig
- pydantic.main.BaseModel
Variables
- static
description : str
- static
model_computed_fields
- static
model_config
- static
model_fields
- static
tags : Optional[list]
- static
template : str
- static
title : str
- static
type : Union[Literal['image-segmentation'], Literal['image-classification'], Literal['object-detection'], Literal['text-classification'], Literal['text-generation'], Literal['tabular-classification'], Literal['tabular-regression']]