GeomAITrainingData#
A GeomAITrainingData
instance is a
collection of GeomAITrainingDataPart
instances representing a geometry that can be used as input for the training of models.
In most cases it will contain a single part: the geometry to train on.
Directory#
- class GeomAITrainingDataDirectory#
Provides a collection of methods related to training data.
This class is accessed through
client.training_data
.Example
List all of the GeomAI training data:
import ansys.simai.core simai = ansys.simai.core.from_config() simai.geomai.training_data.list()
- create(name: str, project: GeomAIProject | str | None = None) GeomAITrainingData #
Create an empty
GeomAITrainingData
object.- Parameters:
name (str) – Name to give the new
GeomAITrainingData
object.project (GeomAIProject | str | None) –
Project
object to associate the data with.
- Returns:
Created
GeomAITrainingData
object.- Return type:
See also
create_from_file()
handles all the creation of training data and parts for you
- create_from_file(file: Path | str | PathLike | Tuple[BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike, str], project: GeomAIProject | str | None = None, monitor_callback: Callable[[int], None] | None = None) GeomAITrainingData #
Convenience function to create a
GeomAITrainingData
object from a file.- Parameters:
file (Path | str | PathLike | Tuple[BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike, str]) –
NamedFile
to upload.project (GeomAIProject | str | None) – Optional project to attach the training data to. Defaults to the configured project if any.
monitor_callback (Callable[[int], None] | None) – Optional callback for monitoring the progress of the download. For more information, see the
MonitorCallback
object.
- delete(training_data: GeomAITrainingData | str) None #
Delete a
GeomAITrainingData
object and its associated parts from the server.- Parameters:
training_data (GeomAITrainingData | str) – ID or
model
object of theGeomAITrainingData
object.
- get(id) GeomAITrainingData #
Get a specific
GeomAITrainingData
object from the server.- Parameters:
id – ID of the training data
- Returns:
- Raises:
NotFoundError – No training data with the given ID exists.
- Return type:
- iter(filters: dict[str, Any] | list[tuple[str, Literal['EQ', 'LIKE', 'IN', 'GT', 'GTE', 'LT', 'LTE'], Any]] | list[RawSingleFilter] | None = None) SizedIterator[GeomAITrainingData] #
Iterate over all
GeomAITrainingData
objects on the server.
- list(filters: dict[str, Any] | list[tuple[str, Literal['EQ', 'LIKE', 'IN', 'GT', 'GTE', 'LT', 'LTE'], Any]] | list[RawSingleFilter] | None = None) List[GeomAITrainingData] #
List all
GeomAITrainingData
objects on the server.Warning
This can take a very long time, consider using
iter()
instead.
- upload_folder(training_data: GeomAITrainingData | str, folder_path: Path | str | PathLike) List[GeomAITrainingDataPart] #
Upload all files in a folder to a
GeomAITrainingData
object.This method automatically requests computation of the training data once the upload is complete unless specified otherwise.
- Parameters:
See also
create_from_file()
handles all the creation of training data and parts for you
- upload_part(training_data: GeomAITrainingData | str, file: Path | str | PathLike | Tuple[BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike, str], monitor_callback: Callable[[int], None] | None = None) GeomAITrainingDataPart #
Add a part to a
GeomAITrainingData
object.- Parameters:
training_data (GeomAITrainingData | str) – ID or
model
object of the training data to add the part to.file (Path | str | PathLike | Tuple[BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike, str]) –
NamedFile
to upload.monitor_callback (Callable[[int], None] | None) – Optional callback for monitoring the progress of the upload. For more information, see the
MonitorCallback
object.
- Returns:
Added
GeomAITrainingDataPart
object.- Return type:
Model#
- class GeomAITrainingData#
Provides the local representation of a training data object.
- add_to_project(project: GeomAIProject | str)#
Add the training data to a
GeomAIProject
object.- Parameters:
project (GeomAIProject | str) – ID or
model
object of the project to add the data to.
- extract_data() None #
Extract or reextract the data from a training data.
Data should be extracted from a training data once all its parts have been fully uploaded. This is done automatically when using
GeomAITrainingDataDirectory.upload_folder()
to create training data.Data can only be reextracted from a training data if the extraction previously failed or if new files have been added.
- remove_from_project(project: GeomAIProject | str)#
Remove the training data from a
GeomAIProject
object.- Parameters:
project (GeomAIProject | str) – ID or
model
of the project to remove data from.- Raises:
ansys.simai.core.errors.ApiClientError – If the data is the project’s sample.
ansys.simai.core.errors.ApiClientError – If the project is in training.
- upload_folder(folder_path: Path | str | PathLike) List[GeomAITrainingDataPart] #
Upload all the parts contained in a folder to a
GeomAITrainingData
instance.Upon upload completion, GeomAI will extract data from each part.
- upload_part(file: Path | str | PathLike | Tuple[BinaryIO | RawIOBase | BufferedIOBase | Path | str | PathLike, str], monitor_callback: Callable[[int], None] | None = None) GeomAITrainingDataPart #
Add a part to the training data.
- Parameters:
- Returns:
Created
GeomAITrainingDataPart
.- Return type:
- wait(timeout: float | None = None) bool #
Wait for all jobs concerning the object to either finish or fail.
- property failure_reason#
Optional message giving the causes for why the creation of the object failed.
See also
- property has_failed#
Boolean indicating if the creation of the object failed.
See also
- property is_pending#
Boolean indicating if the object is still in creation. The value becomes
False
once object creation is either successful or has failed.See also
- property is_ready#
Boolean indicating if the object has finished creating without error.
See also
- property parts: List[GeomAITrainingDataPart]#
List of all
parts
objects in the training data.