gt4sd.configuration module¶
Module configuration.
Summary¶
Classes:
Artifact management configuration. |
|
GT4SDConfiguration settings from environment variables. |
Functions:
Wrapper to initialize a client and list the directories in a bucket. |
|
Get algorithm subdirectories from the cache. |
|
Get algorithms in the s3 buckets. |
|
|
|
Reset the root logger from logging library. |
|
Sync an algorithm in the local cache using environment variables. |
|
Upload an algorithm in source_filepath in target_filepath on a bucket in the model hub. :type target_filepath: |
Reference¶
- class GT4SDConfiguration(_case_sensitive=None, _nested_model_default_partial_update=None, _env_prefix=None, _env_prefix_target=None, _env_file=Path('.'), _env_file_encoding=None, _env_ignore_empty=None, _env_nested_delimiter=None, _env_nested_max_split=None, _env_parse_none_str=None, _env_parse_enums=None, _cli_prog_name=None, _cli_parse_args=None, _cli_settings_source=None, _cli_parse_none_str=None, _cli_hide_none_type=None, _cli_avoid_json=None, _cli_enforce_required=None, _cli_use_class_docs_for_groups=None, _cli_exit_on_error=None, _cli_prefix=None, _cli_flag_prefix_char=None, _cli_implicit_flags=None, _cli_ignore_unknown_args=None, _cli_kebab_case=None, _cli_shortcuts=None, _secrets_dir=None, _build_sources=None, **values)[source]¶
Bases:
BaseSettingsGT4SDConfiguration settings from environment variables.
Default configurations for gt4sd including a read-only COS for algorithms’ artifacts. Default configuration for gt4sd hub including a read-write COS for algorithms’ artifacts uploaded by users.
- gt4sd_local_cache_path: str¶
- gt4sd_local_cache_path_algorithms: str¶
- gt4sd_local_cache_path_properties: str¶
- gt4sd_max_number_of_stuck_calls: int¶
- gt4sd_max_number_of_samples: int¶
- gt4sd_max_runtime: int¶
- gt4sd_create_unverified_ssl_context: bool¶
- gt4sd_disable_cudnn: bool¶
- gt4sd_s3_host: str¶
- gt4sd_s3_access_key: str¶
- gt4sd_s3_secret_key: str¶
- gt4sd_s3_secure: bool¶
- gt4sd_s3_bucket_algorithms: str¶
- gt4sd_s3_bucket_properties: str¶
- gt4sd_s3_host_hub: str¶
- gt4sd_s3_access_key_hub: str¶
- gt4sd_s3_secret_key_hub: str¶
- gt4sd_s3_secure_hub: bool¶
- gt4sd_s3_bucket_hub_algorithms: str¶
- gt4sd_s3_bucket_hub_properties: str¶
- model_config: ClassVar[SettingsConfigDict] = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_shortcuts': None, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': None, 'env_file_encoding': None, 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': '', 'env_prefix_target': 'variable', 'extra': 'forbid', 'frozen': True, 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_config_section': None, 'yaml_file': None, 'yaml_file_encoding': None}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- __dict__¶
- __pydantic_fields_set__: set[str]¶
The names of fields explicitly set during instantiation.
- __pydantic_extra__: Dict[str, Any] | None¶
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_private__: Dict[str, Any] | None¶
Values of private attributes set on the model instance.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[Dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_computed_fields__': 'ClassVar[Dict[str, ComputedFieldInfo]]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'Dict[str, Any] | None', '__pydantic_extra_info__': 'ClassVar[PydanticExtraInfo | None]', '__pydantic_fields__': 'ClassVar[Dict[str, FieldInfo]]', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[Dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | Literal['model_post_init']]", '__pydantic_private__': 'Dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_setattr_handlers__': 'ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]]', '__pydantic_validator__': 'ClassVar[SchemaValidator | PluggableSchemaValidator]', '__signature__': 'ClassVar[Signature]', 'gt4sd_create_unverified_ssl_context': <class 'bool'>, 'gt4sd_disable_cudnn': <class 'bool'>, 'gt4sd_local_cache_path': <class 'str'>, 'gt4sd_local_cache_path_algorithms': <class 'str'>, 'gt4sd_local_cache_path_properties': <class 'str'>, 'gt4sd_max_number_of_samples': <class 'int'>, 'gt4sd_max_number_of_stuck_calls': <class 'int'>, 'gt4sd_max_runtime': <class 'int'>, 'gt4sd_s3_access_key': <class 'str'>, 'gt4sd_s3_access_key_hub': <class 'str'>, 'gt4sd_s3_bucket_algorithms': <class 'str'>, 'gt4sd_s3_bucket_hub_algorithms': <class 'str'>, 'gt4sd_s3_bucket_hub_properties': <class 'str'>, 'gt4sd_s3_bucket_properties': <class 'str'>, 'gt4sd_s3_host': <class 'str'>, 'gt4sd_s3_host_hub': <class 'str'>, 'gt4sd_s3_secret_key': <class 'str'>, 'gt4sd_s3_secret_key_hub': <class 'str'>, 'gt4sd_s3_secure': <class 'bool'>, 'gt4sd_s3_secure_hub': <class 'bool'>, 'model_config': 'ClassVar[SettingsConfigDict]'}¶
- __class_vars__: ClassVar[set[str]] = {}¶
The names of the class variables defined on the model.
- __doc__ = "GT4SDConfiguration settings from environment variables.\n\n Default configurations for gt4sd including a read-only COS for algorithms' artifacts.\n Default configuration for gt4sd hub including a read-write COS for algorithms' artifacts uploaded by users.\n "¶
- __hash__() int¶
Return hash(self).
- Return type
int
- __module__ = 'gt4sd.configuration'¶
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}¶
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True¶
Whether model building is completed, or if there are still undefined fields.
- __pydantic_computed_fields__: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'gt4sd.configuration.GT4SDConfiguration'>, 'config': {'extra_fields_behavior': 'forbid', 'title': 'GT4SDConfiguration', 'validate_default': True}, 'custom_init': True, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'gt4sd.configuration.GT4SDConfiguration'>>]}, 'ref': 'gt4sd.configuration.GT4SDConfiguration:94818137509888', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'gt4sd_create_unverified_ssl_context': {'metadata': {}, 'schema': {'default': False, 'schema': {'type': 'bool'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_disable_cudnn': {'metadata': {}, 'schema': {'default': False, 'schema': {'type': 'bool'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_local_cache_path': {'metadata': {}, 'schema': {'default': '/home/runner/.gt4sd', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_local_cache_path_algorithms': {'metadata': {}, 'schema': {'default': 'algorithms', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_local_cache_path_properties': {'metadata': {}, 'schema': {'default': 'properties', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_max_number_of_samples': {'metadata': {}, 'schema': {'default': 1000000, 'schema': {'type': 'int'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_max_number_of_stuck_calls': {'metadata': {}, 'schema': {'default': 50, 'schema': {'type': 'int'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_max_runtime': {'metadata': {}, 'schema': {'default': 86400, 'schema': {'type': 'int'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_access_key': {'metadata': {}, 'schema': {'default': '903d388dcbfe434da80b08ac8e74eaf6', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_access_key_hub': {'metadata': {}, 'schema': {'default': '1168c1d9ce664e75a8a151e6f4a29078', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_bucket_algorithms': {'metadata': {}, 'schema': {'default': 'gt4sd-cos-algorithms-artifacts', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_bucket_hub_algorithms': {'metadata': {}, 'schema': {'default': 'gt4sd-cos-hub-algorithms-artifacts', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_bucket_hub_properties': {'metadata': {}, 'schema': {'default': 'gt4sd-cos-hub-properties-artifacts', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_bucket_properties': {'metadata': {}, 'schema': {'default': 'gt4sd-cos-properties-artifacts', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_host': {'metadata': {}, 'schema': {'default': 's3.par01.cloud-object-storage.appdomain.cloud', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_host_hub': {'metadata': {}, 'schema': {'default': 's3.par01.cloud-object-storage.appdomain.cloud', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_secret_key': {'metadata': {}, 'schema': {'default': '1f33e15f41bcf7412551bd343108c40fc81a16da5a5fe081', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_secret_key_hub': {'metadata': {}, 'schema': {'default': '4996c6cc737828213a7afcc7e27450e1af2daf027af95c1d', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_secure': {'metadata': {}, 'schema': {'default': True, 'schema': {'type': 'bool'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_secure_hub': {'metadata': {}, 'schema': {'default': True, 'schema': {'type': 'bool'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'GT4SDConfiguration', 'type': 'model-fields'}, 'type': 'model'}¶
The core schema of the model.
- __pydantic_custom_init__: ClassVar[bool] = True¶
Whether the model has a custom __init__ method.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra_info__: ClassVar[PydanticExtraInfo | None] = None¶
A wrapper around the __pydantic_extra__ annotation, if explicitly annotated on a model.
This is a private attribute, not meant to be used outside Pydantic.
- __pydantic_fields__: ClassVar[Dict[str, FieldInfo]] = {'gt4sd_create_unverified_ssl_context': FieldInfo(annotation=bool, required=False, default=False), 'gt4sd_disable_cudnn': FieldInfo(annotation=bool, required=False, default=False), 'gt4sd_local_cache_path': FieldInfo(annotation=str, required=False, default='/home/runner/.gt4sd'), 'gt4sd_local_cache_path_algorithms': FieldInfo(annotation=str, required=False, default='algorithms'), 'gt4sd_local_cache_path_properties': FieldInfo(annotation=str, required=False, default='properties'), 'gt4sd_max_number_of_samples': FieldInfo(annotation=int, required=False, default=1000000), 'gt4sd_max_number_of_stuck_calls': FieldInfo(annotation=int, required=False, default=50), 'gt4sd_max_runtime': FieldInfo(annotation=int, required=False, default=86400), 'gt4sd_s3_access_key': FieldInfo(annotation=str, required=False, default='903d388dcbfe434da80b08ac8e74eaf6'), 'gt4sd_s3_access_key_hub': FieldInfo(annotation=str, required=False, default='1168c1d9ce664e75a8a151e6f4a29078'), 'gt4sd_s3_bucket_algorithms': FieldInfo(annotation=str, required=False, default='gt4sd-cos-algorithms-artifacts'), 'gt4sd_s3_bucket_hub_algorithms': FieldInfo(annotation=str, required=False, default='gt4sd-cos-hub-algorithms-artifacts'), 'gt4sd_s3_bucket_hub_properties': FieldInfo(annotation=str, required=False, default='gt4sd-cos-hub-properties-artifacts'), 'gt4sd_s3_bucket_properties': FieldInfo(annotation=str, required=False, default='gt4sd-cos-properties-artifacts'), 'gt4sd_s3_host': FieldInfo(annotation=str, required=False, default='s3.par01.cloud-object-storage.appdomain.cloud'), 'gt4sd_s3_host_hub': FieldInfo(annotation=str, required=False, default='s3.par01.cloud-object-storage.appdomain.cloud'), 'gt4sd_s3_secret_key': FieldInfo(annotation=str, required=False, default='1f33e15f41bcf7412551bd343108c40fc81a16da5a5fe081'), 'gt4sd_s3_secret_key_hub': FieldInfo(annotation=str, required=False, default='4996c6cc737828213a7afcc7e27450e1af2daf027af95c1d'), 'gt4sd_s3_secure': FieldInfo(annotation=bool, required=False, default=True), 'gt4sd_s3_secure_hub': FieldInfo(annotation=bool, required=False, default=True)}¶
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}¶
A dictionary containing metadata about generic Pydantic models.
The origin and args items map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and the parameter item maps to the __parameter__ attribute of generic classes.
- __pydantic_parent_namespace__: ClassVar[Dict[str, Any] | None] = None¶
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None¶
The name of the post-init method for the model, if defined.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c91679000, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c91679000, ), serializer: Model( ModelSerializer { class: Py( 0x0000563c91679000, ), serializer: Fields( GeneralFieldsSerializer { fields: { "gt4sd_create_unverified_ssl_context": SerField { key: "gt4sd_create_unverified_ssl_context", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000563c55c1c6c0, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_disable_cudnn": SerField { key: "gt4sd_disable_cudnn", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000563c55c1c6c0, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_s3_host": SerField { key: "gt4sd_s3_host", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222bfa1b90, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_max_number_of_samples": SerField { key: "gt4sd_max_number_of_samples", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222bf31390, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_local_cache_path": SerField { key: "gt4sd_local_cache_path", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222b10add0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_s3_access_key": SerField { key: "gt4sd_s3_access_key", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222bfa1bf0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_s3_secure": SerField { key: "gt4sd_s3_secure", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000563c55c1c6e0, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_local_cache_path_algorithms": SerField { key: "gt4sd_local_cache_path_algorithms", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222cbd9ff0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_max_number_of_stuck_calls": SerField { key: "gt4sd_max_number_of_stuck_calls", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300710, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_max_runtime": SerField { key: "gt4sd_max_runtime", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222bf31310, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_s3_host_hub": SerField { key: "gt4sd_s3_host_hub", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222bfa1b90, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_s3_secret_key_hub": SerField { key: "gt4sd_s3_secret_key_hub", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222bf8e090, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_s3_secret_key": SerField { key: "gt4sd_s3_secret_key", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222bf8e020, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_local_cache_path_properties": SerField { key: "gt4sd_local_cache_path_properties", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222e8d6fb0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_s3_bucket_hub_algorithms": SerField { key: "gt4sd_s3_bucket_hub_algorithms", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222bfa1cb0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_s3_bucket_hub_properties": SerField { key: "gt4sd_s3_bucket_hub_properties", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222bfa1d10, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_s3_secure_hub": SerField { key: "gt4sd_s3_secure_hub", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000563c55c1c6e0, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_s3_bucket_properties": SerField { key: "gt4sd_s3_bucket_properties", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222bfbe420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_s3_bucket_algorithms": SerField { key: "gt4sd_s3_bucket_algorithms", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222bfbe380, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gt4sd_s3_access_key_hub": SerField { key: "gt4sd_s3_access_key_hub", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222bfa1c50, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 20, }, ), has_extra: false, root_model: false, name: "GT4SDConfiguration", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}¶
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="GT4SDConfiguration", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "gt4sd_local_cache_path", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_local_cache_path", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222b10add0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_local_cache_path_algorithms", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_local_cache_path_algorithms", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222cbd9ff0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_local_cache_path_properties", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_local_cache_path_properties", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222e8d6fb0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_max_number_of_stuck_calls", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_max_number_of_stuck_calls", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300710, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: true, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_max_number_of_samples", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_max_number_of_samples", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222bf31390, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: true, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_max_runtime", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_max_runtime", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222bf31310, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: true, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_create_unverified_ssl_context", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_create_unverified_ssl_context", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000563c55c1c6c0, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: true, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_disable_cudnn", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_disable_cudnn", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000563c55c1c6c0, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: true, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_s3_host", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_s3_host", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222bfa1b90, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_s3_access_key", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_s3_access_key", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222bfa1bf0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_s3_secret_key", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_s3_secret_key", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222bf8e020, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_s3_secure", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_s3_secure", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000563c55c1c6e0, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: true, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_s3_bucket_algorithms", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_s3_bucket_algorithms", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222bfbe380, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_s3_bucket_properties", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_s3_bucket_properties", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222bfbe420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_s3_host_hub", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_s3_host_hub", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222bfa1b90, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_s3_access_key_hub", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_s3_access_key_hub", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222bfa1c50, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_s3_secret_key_hub", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_s3_secret_key_hub", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222bf8e090, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_s3_secure_hub", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_s3_secure_hub", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000563c55c1c6e0, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: true, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_s3_bucket_hub_algorithms", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_s3_bucket_hub_algorithms", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222bfa1cb0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { name: "gt4sd_s3_bucket_hub_properties", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gt4sd_s3_bucket_hub_properties", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222bfa1d10, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, ], model_name: "GT4SDConfiguration", extra_behavior: Forbid, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "gt4sd_s3_access_key", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 9, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_s3_bucket_properties", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 13, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_s3_host_hub", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 14, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_s3_secret_key_hub", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 16, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_s3_secure_hub", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 17, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_s3_bucket_hub_algorithms", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 18, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_max_number_of_stuck_calls", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 3, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_s3_bucket_algorithms", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 12, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_local_cache_path", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_local_cache_path_algorithms", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 1, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_max_number_of_samples", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 4, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_s3_secret_key", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 10, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_s3_secure", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 11, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_s3_access_key_hub", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 15, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_local_cache_path_properties", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 2, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_s3_bucket_hub_properties", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 19, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_s3_host", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 8, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_disable_cudnn", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 7, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_create_unverified_ssl_context", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 6, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "gt4sd_max_runtime", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 5, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x0000563c91679000, ), generic_origin: None, post_init: None, frozen: false, custom_init: true, root_model: false, undefined: Py( 0x00007f222cf13af0, ), name: "GT4SDConfiguration", }, ), definitions=[], cache_strings=True)¶
The pydantic-core SchemaValidator used to validate instances of the model.
- __signature__: ClassVar[Signature] = <Signature (_case_sensitive: 'bool | None' = None, _nested_model_default_partial_update: 'bool | None' = None, _env_prefix: 'str | None' = None, _env_prefix_target: 'EnvPrefixTarget | None' = None, _env_file: 'DotenvType | None' = Path('.'), _env_file_encoding: 'str | None' = None, _env_ignore_empty: 'bool | None' = None, _env_nested_delimiter: 'str | None' = None, _env_nested_max_split: 'int | None' = None, _env_parse_none_str: 'str | None' = None, _env_parse_enums: 'bool | None' = None, _cli_prog_name: 'str | None' = None, _cli_parse_args: 'bool | list[str] | tuple[str, ...] | None' = None, _cli_settings_source: 'CliSettingsSource[Any] | None' = None, _cli_parse_none_str: 'str | None' = None, _cli_hide_none_type: 'bool | None' = None, _cli_avoid_json: 'bool | None' = None, _cli_enforce_required: 'bool | None' = None, _cli_use_class_docs_for_groups: 'bool | None' = None, _cli_exit_on_error: 'bool | None' = None, _cli_prefix: 'str | None' = None, _cli_flag_prefix_char: 'str | None' = None, _cli_implicit_flags: "bool | Literal['dual', 'toggle'] | None" = None, _cli_ignore_unknown_args: 'bool | None' = None, _cli_kebab_case: "bool | Literal['all', 'no_enums'] | None" = None, _cli_shortcuts: 'Mapping[str, str | list[str]] | None' = None, _secrets_dir: 'PathType | None' = None, _build_sources: 'tuple[tuple[PydanticBaseSettingsSource, ...], dict[str, Any]] | None' = None, *, gt4sd_local_cache_path: str = '/home/runner/.gt4sd', gt4sd_local_cache_path_algorithms: str = 'algorithms', gt4sd_local_cache_path_properties: str = 'properties', gt4sd_max_number_of_stuck_calls: int = 50, gt4sd_max_number_of_samples: int = 1000000, gt4sd_max_runtime: int = 86400, gt4sd_create_unverified_ssl_context: bool = False, gt4sd_disable_cudnn: bool = False, gt4sd_s3_host: str = 's3.par01.cloud-object-storage.appdomain.cloud', gt4sd_s3_access_key: str = '903d388dcbfe434da80b08ac8e74eaf6', gt4sd_s3_secret_key: str = '1f33e15f41bcf7412551bd343108c40fc81a16da5a5fe081', gt4sd_s3_secure: bool = True, gt4sd_s3_bucket_algorithms: str = 'gt4sd-cos-algorithms-artifacts', gt4sd_s3_bucket_properties: str = 'gt4sd-cos-properties-artifacts', gt4sd_s3_host_hub: str = 's3.par01.cloud-object-storage.appdomain.cloud', gt4sd_s3_access_key_hub: str = '1168c1d9ce664e75a8a151e6f4a29078', gt4sd_s3_secret_key_hub: str = '4996c6cc737828213a7afcc7e27450e1af2daf027af95c1d', gt4sd_s3_secure_hub: bool = True, gt4sd_s3_bucket_hub_algorithms: str = 'gt4sd-cos-hub-algorithms-artifacts', gt4sd_s3_bucket_hub_properties: str = 'gt4sd-cos-hub-properties-artifacts') -> None>¶
The synthesized __init__ [Signature][inspect.Signature] of the model.
- _abc_impl = <_abc._abc_data object>¶
- class GT4SDArtifactManagementConfiguration(gt4sd_configuration)[source]¶
Bases:
objectArtifact management configuration.
- gt4sd_s3_modules: Set[str] = {'algorithms', 'properties'}¶
- __init__(gt4sd_configuration)[source]¶
Initialize the artifact management configuration from the base one.
- Parameters
gt4sd_configuration (
GT4SDConfiguration) – GT4SD base configuration.
- __annotations__ = {'gt4sd_s3_modules': typing.Set[str], 'local_cache_path': 'Dict[str, str]', 's3_bucket': 'Dict[str, str]', 's3_bucket_hub': 'Dict[str, str]'}¶
- __dict__ = mappingproxy({'__module__': 'gt4sd.configuration', '__annotations__': {'gt4sd_s3_modules': typing.Set[str], 'local_cache_path': 'Dict[str, str]', 's3_bucket': 'Dict[str, str]', 's3_bucket_hub': 'Dict[str, str]'}, '__doc__': 'Artifact management configuration.', 'gt4sd_s3_modules': {'algorithms', 'properties'}, '__init__': <function GT4SDArtifactManagementConfiguration.__init__>, '__dict__': <attribute '__dict__' of 'GT4SDArtifactManagementConfiguration' objects>, '__weakref__': <attribute '__weakref__' of 'GT4SDArtifactManagementConfiguration' objects>})¶
- __doc__ = 'Artifact management configuration.'¶
- __module__ = 'gt4sd.configuration'¶
- __weakref__¶
list of weak references to the object (if defined)
- upload_to_s3(target_filepath, source_filepath, module='algorithms')[source]¶
Upload an algorithm in source_filepath in target_filepath on a bucket in the model hub. :type target_filepath:
str:param target_filepath: path to save the objects in s3. :type source_filepath:str:param source_filepath: path to the file to sync. :type module:str:param module: the submodule of gt4sd that acts as a root for the bucket, defaultsto algorithms.
- sync_algorithm_with_s3(prefix=None, module='algorithms')[source]¶
Sync an algorithm in the local cache using environment variables.
- Parameters
prefix (
Optional[str,None]) – the relative path in the bucket (both on S3 and locally) to match files to download. Defaults to None.module (
str) – the submodule of gt4sd that acts as a root for the bucket, defaults to algorithms.
- Returns
local path using the prefix.
- Return type
str
- get_algorithm_subdirectories_from_s3_coordinates(host, access_key, secret_key, bucket, secure=True, prefix=None)[source]¶
Wrapper to initialize a client and list the directories in a bucket.
- Return type
Set[str]
- get_algorithm_subdirectories_with_s3(prefix=None, module='algorithms')[source]¶
Get algorithms in the s3 buckets.
- Parameters
prefix (
Optional[str,None]) – the relative path in the bucket (both on S3 and locally) to match files to download. Defaults to None.module (
str) – the submodule of gt4sd that acts as a root for the bucket, defaults to algorithms.
- Returns
set of available algorithms on s3 with that prefix.
- Return type
Set
- get_algorithm_subdirectories_in_cache(prefix=None, module='algorithms')[source]¶
Get algorithm subdirectories from the cache.
- Parameters
prefix (
Optional[str,None]) – prefix matching cache subdirectories. Defaults to None.module (
str) – the submodule of gt4sd that acts as a root for the bucket, defaults to algorithms.
- Return type
Set[str]- Returns
a set of subdirectories.