pixaris.orchestration package
Submodules
pixaris.orchestration.base module
- pixaris.orchestration.base.generate_image(data, image_generator, args, failed_args)[source]
Generates a single image based on the provided data and image generator.
- Parameters:
data (dict) – input data, e.g. a dictionary containing images and masks
image_generator (ImageGenerator) – the image generator to use for generating images
args (dict) – additional arguments for image generation. To be set during generation
failed_args (list) – list to store failed arguments. Has to exist and be handled outside this function.
- Returns:
generated image and name
- Return type:
tuple[PIL.Image.Image, str]
- pixaris.orchestration.base.generate_images_based_on_dataset(data_loader: DatasetLoader, image_generator: ImageGenerator, experiment_handler: ExperimentHandler, metrics: list[BaseMetric], args: dict[str, any]) Iterable[tuple[Image, str]] [source]
Generates images based on an evaluation set. This function loads a dataset using the provided data loader, generates images using the provided image generator, and stores the results using the provided experiment handler.
- Parameters:
data_loader (DatasetLoader) – An instance of DatasetLoader to load the dataset.
image_generator (ImageGenerator) – An instance of ImageGenerator to generate images.
experiment_handler (ExperimentHandler) – An instance of ExperimentHandler to store the generated images and results.
metrics (list[BaseMetric]) – A list of metrics to calculate.
args (dict[str, any]) – A dictionary of arguments to be used for image generation and storing results.
- Returns:
A list of generated images and names
- Return type:
list[tuple[PIL.Image.Image, str]]
- pixaris.orchestration.base.generate_images_for_hyperparameter_search_based_on_dataset(data_loader: DatasetLoader, image_generator: ImageGenerator, experiment_handler: ExperimentHandler, metrics: list[BaseMetric], args: dict[str, any])[source]
Generates images for hyperparameter search based on the evaluation set. This function performs a hyperparameter search by generating images for each combination of hyperparameters provided. It validates the hyperparameters, generates a grid of hyperparameter combinations, and then generates images for each combination using the provided data loader, image generator, and experiment handler.
- Parameters:
data_loader (DatasetLoader) – The data loader to load the evaluation set.
image_generator (ImageGenerator) – The image generator to generate images.
experiment_handler (ExperimentHandler) – The experiment handler to save generated images.
metrics (list[BaseMetric]) – A list of metrics to calculate.
args – A dictionary of arguments, including:
“workflow_apiformat_json” (str): The path to the workflow file in API format.
“hyperparameters” list(dict): A dictionary of hyperparameters to search. Each element of the list should be compatible with the generation parameters, that the image_generator takes as an input.
“experiment_run_name” (str): The base name for each run.
- Raises:
ValueError – If no hyperparameters are provided or if the hyperparameters are invalid.
pixaris.orchestration.kubernetes module
- pixaris.orchestration.kubernetes.copy_bytes_to_pod(kube_conn, namespace: str, pod_name: str, bytes_to_copy: bytes, dest_path: str)[source]
Copy a file to a pod comparable with kubectl cp. See here: https://github.com/kubernetes-client/python/issues/476#issuecomment-2701387338
- Parameters:
kube_conn – The connection to the Kubernetes cluster.
namespace – The namespace of the pod.
pod_name – The name of the pod.
bytes_to_copy – The bytes to be copied.
dest_path – The destination path on the pod.
- pixaris.orchestration.kubernetes.pixaris_orchestration_kubernetes_locally(data_loader: DatasetLoader, image_generator: ImageGenerator, experiment_handler: ExperimentHandler, metrics: list[BaseMetric], args: dict[str, any], auto_scale: bool)[source]
Trigger remote evaluation on the Kubernetes cluster. This function will pickle the inputs and upload them to the Kubernetes cluster. It will then trigger the remote evaluation.
- Parameters:
data_loader (DatasetLoader) – The data loader to load the evaluation set.
image_generator (ImageGenerator) – The image generator to generate images. E.g. ComfyClusterGenerator
experiment_handler (ExperimentHandler) – The experiment handler to save generated images.
metrics (list[BaseMetric]) – The metrics to calculate.
auto_scale (bool) – Whether to auto scale the cluster to the maximum number of parallel jobs.
args – A dictionary of arguments, including:
“workflow_apiformat_json” (str): The path to the workflow file in API format.
“workflow_pillow_image” (PIL.Image): The image to use as input for the workflow.
“dataset” (str): The evaluation set to use.
“pillow_images” (list[dict]): A list of images to use as input for the workflow.
“experiment_run_name” (str): The name of the run.
“max_parallel_jobs” (int): The maximum number of parallel jobs to run.