gt4sd.algorithms.generation.diffusion.core module¶
HuggingFace Diffusers generation algorithm. Code and models adapted from https://github.com/huggingface/diffusers.
Summary¶
Classes:
DDIM - Configuration to generate using a denoising diffusion implicit model. |
|
DDPM - Configuration to generate using unconditional denoising diffusion models. |
|
Basic configuration for a diffusion algorithm. |
|
GeoDiff Diffusion Model - Configuration for conditional 3D molecule structure generation given 2D information using a GeoDiff diffusion model. |
|
Unconditional Latent Diffusion Model - Configuration to generate using a latent diffusion model. |
|
Conditional Latent Diffusion Model - Configuration for conditional text2image generation using a latent diffusion model. |
|
Score SDE Generative Model - Configuration to generate using a score-based diffusion generative model. |
|
Stable Diffusion Model - Configuration for conditional text2image generation using a stable diffusion model. |
Reference¶
- class DiffusersGenerationAlgorithm(configuration, target=None)[source]¶
Bases:
GeneratorAlgorithm
[S
,None
]- __init__(configuration, target=None)[source]¶
Diffusers generation algorithm.
- Parameters
configuration (
AlgorithmConfiguration
) – domain and application specification, defining types and validations.target (
Optional
[~S,None
]) – none for untargeted generation.
Example
An example for using a generative algorithm from Diffusers:
configuration = GeneratorConfiguration() algorithm = DiffusersGenerationAlgorithm(configuration=configuration) items = list(algorithm.sample(1)) print(items)
- get_generator(configuration, target)[source]¶
Get the function to sample batches.
- Parameters
configuration (
AlgorithmConfiguration
[~S,None
]) – helps to set up the application.target (
None
) – context or condition for the generation.
- Return type
Callable
[[],Iterable
[Any
]]- Returns
callable generating a batch of items.
- validate_configuration(configuration)[source]¶
Overload to validate the a configuration for the algorithm.
- Parameters
configuration (
AlgorithmConfiguration
) – the algorithm configuration.- Raises
InvalidAlgorithmConfiguration – in case the configuration for the algorithm is invalid.
- Return type
- Returns
the validated configuration.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'generate': 'Untargeted', 'generator': 'Union[Untargeted, Targeted[T]]', 'max_runtime': 'int', 'max_samples': 'int', 'target': 'Optional[T]'}¶
- __doc__ = None¶
- __module__ = 'gt4sd.algorithms.generation.diffusion.core'¶
- __orig_bases__ = (gt4sd.algorithms.core.GeneratorAlgorithm[~S, NoneType],)¶
- __parameters__ = (~S,)¶
- _abc_impl = <_abc._abc_data object>¶
- class DiffusersConfiguration(*args, **kwargs)[source]¶
Bases:
DiffusersConfiguration
,Generic
[T
]Basic configuration for a diffusion algorithm.
- algorithm_type: ClassVar[str] = 'generation'¶
General type of generative algorithm.
- domain: ClassVar[str] = 'vision'¶
General application domain. Hints at input/output types.
- modality: str = 'image'¶
- model_type: str = 'diffusion'¶
- scheduler_type: str = 'discrete'¶
- prompt: Union[str, Dict[str, Any]] = None¶
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': 'ClassVar[str]', 'algorithm_type': typing.ClassVar[str], 'algorithm_version': 'str', 'domain': typing.ClassVar[str], 'modality': <class 'str'>, 'model_type': <class 'str'>, 'prompt': typing.Union[str, typing.Dict[str, typing.Any]], 'scheduler_type': <class 'str'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='DiffusersConfiguration',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='DiffusersGenerationAlgorithm',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type='str',default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='vision',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'modality': Field(name='modality',type=<class 'str'>,default='image',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': "Modality. Supported: 'image', 'text', 'audio', 'molecule'."}),kw_only=False,_field_type=_FIELD), 'model_type': Field(name='model_type',type=<class 'str'>,default='diffusion',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Type of the model. Supported: diffusion, diffusion_implicit, latent_diffusion, latent_diffusion_conditional, stable_diffusion, score_sde, geodiff'}),kw_only=False,_field_type=_FIELD), 'prompt': Field(name='prompt',type=typing.Union[str, typing.Dict[str, typing.Any]],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Prompt for conditional generation.'}),kw_only=False,_field_type=_FIELD), 'scheduler_type': Field(name='scheduler_type',type=<class 'str'>,default='discrete',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Type of the noise scheduler. Supported: ddpm, ddim, discrete, continuous'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Basic configuration for a diffusion algorithm.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __match_args__ = ('algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt')¶
- __module__ = 'gt4sd.algorithms.generation.diffusion.core'¶
- __orig_bases__ = (<class 'types.DiffusersConfiguration'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.generation.diffusion.core.DiffusersConfiguration'>, 'config': {'title': 'DiffusersConfiguration'}, 'fields': ['algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt'], 'frozen': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.generation.diffusion.core.DiffusersConfiguration'>, title=None)]}, 'post_init': False, 'ref': 'types.DiffusersConfiguration:94662818878688', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'DiffusersConfiguration', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': ''}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'modality', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'image'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'model_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'diffusion'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'scheduler_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'discrete'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'prompt', 'schema': {'type': 'default', 'schema': {'type': 'union', 'choices': [{'type': 'str'}, {'type': 'dict', 'keys_schema': {'type': 'str'}, 'values_schema': {'type': 'any'}}]}, 'default': None}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='', init=True, init_var=False, kw_only=False), 'modality': FieldInfo(annotation=str, required=False, default='image', description="Modality. Supported: 'image', 'text', 'audio', 'molecule'.", init=True, init_var=False, kw_only=False), 'model_type': FieldInfo(annotation=str, required=False, default='diffusion', description='Type of the model. Supported: diffusion, diffusion_implicit, latent_diffusion, latent_diffusion_conditional, stable_diffusion, score_sde, geodiff', init=True, init_var=False, kw_only=False), 'prompt': FieldInfo(annotation=Union[str, Dict[str, Any]], required=False, default=None, description='Prompt for conditional generation.', init=True, init_var=False, kw_only=False), 'scheduler_type': FieldInfo(annotation=str, required=False, default='discrete', description='Type of the noise scheduler. Supported: ddpm, ddim, discrete, continuous', init=True, init_var=False, kw_only=False)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x0000561867b154e0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "algorithm_version": SerField { key_py: Py( 0x00007f1dcaa843a0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9470030, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "modality": SerField { key_py: Py( 0x00007f1dc52667f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea8baf770, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "model_type": SerField { key_py: Py( 0x00007f1dc5266830, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dde81f230, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "prompt": SerField { key_py: Py( 0x00007f1dc52668b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x000056185a457740, ), ), serializer: Union( UnionSerializer { choices: [ Str( StrSerializer, ), Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), ], name: "Union[str, dict[str, any]]", }, ), }, ), ), required: true, }, "scheduler_type": SerField { key_py: Py( 0x00007f1dc5266870, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1de8e5d230, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 5, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], name: "DiffusersConfiguration", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="DiffusersConfiguration", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcaa86fb0, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcaa86f60, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9470030, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "modality", py_name: Py( 0x00007f1de4969070, ), init: true, init_only: false, lookup_key: Simple { key: "modality", py_key: Py( 0x00007f1dc52666b0, ), path: LookupPath( [ S( "modality", Py( 0x00007f1dc5266670, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea8baf770, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "model_type", py_name: Py( 0x00007f1ea6163a30, ), init: true, init_only: false, lookup_key: Simple { key: "model_type", py_key: Py( 0x00007f1dc5266630, ), path: LookupPath( [ S( "model_type", Py( 0x00007f1dc52658b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dde81f230, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "scheduler_type", py_name: Py( 0x00007f1dc51a5c30, ), init: true, init_only: false, lookup_key: Simple { key: "scheduler_type", py_key: Py( 0x00007f1dc52666f0, ), path: LookupPath( [ S( "scheduler_type", Py( 0x00007f1dc5266730, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1de8e5d230, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "prompt", py_name: Py( 0x00007f1ea914d4b0, ), init: true, init_only: false, lookup_key: Simple { key: "prompt", py_key: Py( 0x00007f1dc5266770, ), path: LookupPath( [ S( "prompt", Py( 0x00007f1dc52667b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x000056185a457740, ), ), on_error: Raise, validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, name: "dict[str,any]", }, ), None, ), ], custom_error: None, strict: false, name: "union[str,dict[str,any]]", }, ), validate_default: false, copy_default: false, name: "default[union[str,dict[str,any]]]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, ], positional_count: 5, init_only_count: None, dataclass_name: "DiffusersConfiguration", validator_name: "dataclass-args[DiffusersConfiguration]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, }, ), class: Py( 0x0000561867b154e0, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], post_init: None, revalidate: Never, name: "DiffusersConfiguration", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (algorithm_version: 'str' = '', modality: str = 'image', model_type: str = 'diffusion', scheduler_type: str = 'discrete', prompt: Union[str, Dict[str, Any]] = None) -> None>¶
- __wrapped__¶
alias of
DiffusersConfiguration
- class DDPMGenerator(*args, **kwargs)[source]¶
Bases:
DDPMGenerator
DDPM - Configuration to generate using unconditional denoising diffusion models.
- algorithm_version: str = 'google/ddpm-cifar10-32'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- model_type: str = 'diffusion'¶
- scheduler_type: str = 'ddpm'¶
- modality: str = 'image'¶
- classmethod list_versions()[source]¶
Get possible algorithm versions.
Standard S3 and cache search adding the version used in the configuration.
- Return type
Set
[str
]- Returns
viable values as
algorithm_version
for the environment.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': 'ClassVar[str]', 'algorithm_type': 'ClassVar[str]', 'algorithm_version': <class 'str'>, 'domain': 'ClassVar[str]', 'modality': <class 'str'>, 'model_type': <class 'str'>, 'prompt': 'Union[str, Dict[str, Any]]', 'scheduler_type': <class 'str'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='DDPMGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='DiffusersGenerationAlgorithm',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='google/ddpm-cifar10-32',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='vision',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'modality': Field(name='modality',type=<class 'str'>,default='image',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'model_type': Field(name='model_type',type=<class 'str'>,default='diffusion',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'prompt': Field(name='prompt',type=typing.Union[str, typing.Dict[str, typing.Any]],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Prompt for conditional generation.'}),kw_only=False,_field_type=_FIELD), 'scheduler_type': Field(name='scheduler_type',type=<class 'str'>,default='ddpm',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'DDPM - Configuration to generate using unconditional denoising diffusion models.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __match_args__ = ('algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt')¶
- __module__ = 'gt4sd.algorithms.generation.diffusion.core'¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.generation.diffusion.core.DDPMGenerator'>, 'config': {'title': 'DDPMGenerator'}, 'fields': ['algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt'], 'frozen': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.generation.diffusion.core.DDPMGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.DDPMGenerator:94662818916992', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'DDPMGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'google/ddpm-cifar10-32'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'modality', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'image'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'model_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'diffusion'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'scheduler_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'ddpm'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'prompt', 'schema': {'type': 'default', 'schema': {'type': 'union', 'choices': [{'type': 'str'}, {'type': 'dict', 'keys_schema': {'type': 'str'}, 'values_schema': {'type': 'any'}}]}, 'default': None}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='google/ddpm-cifar10-32', init=True, init_var=False, kw_only=False), 'modality': FieldInfo(annotation=str, required=False, default='image', init=True, init_var=False, kw_only=False), 'model_type': FieldInfo(annotation=str, required=False, default='diffusion', init=True, init_var=False, kw_only=False), 'prompt': FieldInfo(annotation=Union[str, Dict[str, Any]], required=False, default=None, description='Prompt for conditional generation.', init=True, init_var=False, kw_only=False), 'scheduler_type': FieldInfo(annotation=str, required=False, default='ddpm', init=True, init_var=False, kw_only=False)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x0000561867b1ea80, ), serializer: Fields( GeneralFieldsSerializer { fields: { "algorithm_version": SerField { key_py: Py( 0x00007f1dcae55f70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dcaf2db60, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "scheduler_type": SerField { key_py: Py( 0x00007f1dc5264170, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ddd49c030, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "modality": SerField { key_py: Py( 0x00007f1dc52641b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea8baf770, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "model_type": SerField { key_py: Py( 0x00007f1dc52640f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dde81f230, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "prompt": SerField { key_py: Py( 0x00007f1dc5264130, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x000056185a457740, ), ), serializer: Union( UnionSerializer { choices: [ Str( StrSerializer, ), Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), ], name: "Union[str, dict[str, any]]", }, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 5, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], name: "DDPMGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="DDPMGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcae55c00, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcae55b60, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dcaf2db60, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "modality", py_name: Py( 0x00007f1de4969070, ), init: true, init_only: false, lookup_key: Simple { key: "modality", py_key: Py( 0x00007f1dc5255130, ), path: LookupPath( [ S( "modality", Py( 0x00007f1dc50785b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea8baf770, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "model_type", py_name: Py( 0x00007f1ea6163a30, ), init: true, init_only: false, lookup_key: Simple { key: "model_type", py_key: Py( 0x00007f1dc5078570, ), path: LookupPath( [ S( "model_type", Py( 0x00007f1dc5078530, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dde81f230, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "scheduler_type", py_name: Py( 0x00007f1dc51a5c30, ), init: true, init_only: false, lookup_key: Simple { key: "scheduler_type", py_key: Py( 0x00007f1dc50785f0, ), path: LookupPath( [ S( "scheduler_type", Py( 0x00007f1dc5078630, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ddd49c030, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "prompt", py_name: Py( 0x00007f1ea914d4b0, ), init: true, init_only: false, lookup_key: Simple { key: "prompt", py_key: Py( 0x00007f1dc5078670, ), path: LookupPath( [ S( "prompt", Py( 0x00007f1dc50786b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x000056185a457740, ), ), on_error: Raise, validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, name: "dict[str,any]", }, ), None, ), ], custom_error: None, strict: false, name: "union[str,dict[str,any]]", }, ), validate_default: false, copy_default: false, name: "default[union[str,dict[str,any]]]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, ], positional_count: 5, init_only_count: None, dataclass_name: "DDPMGenerator", validator_name: "dataclass-args[DDPMGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, }, ), class: Py( 0x0000561867b1ea80, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], post_init: None, revalidate: Never, name: "DDPMGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (*args: Any, algorithm_version: str = 'google/ddpm-cifar10-32', modality: str = 'image', model_type: str = 'diffusion', scheduler_type: str = 'ddpm', prompt: Union[str, Dict[str, Any]] = None) -> None>¶
- __wrapped__¶
alias of
DDPMGenerator
- algorithm_application: ClassVar[str] = 'DDPMGenerator'¶
Unique name for the application that is the use of this configuration together with a specific algorithm.
Will be set when registering to
ApplicationsRegistry
, but can be given by direct registration (Seeregister_algorithm_application
)
- algorithm_name: ClassVar[str] = 'DiffusersGenerationAlgorithm'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- class DDIMGenerator(*args, **kwargs)[source]¶
Bases:
DDIMGenerator
DDIM - Configuration to generate using a denoising diffusion implicit model.
- algorithm_version: str = 'dboshardy/ddim-butterflies-128'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- model_type: str = 'diffusion_implicit'¶
- scheduler_type: str = 'ddim'¶
- modality: str = 'image'¶
- classmethod list_versions()[source]¶
Get possible algorithm versions.
Standard S3 and cache search adding the version used in the configuration.
- Return type
Set
[str
]- Returns
viable values as
algorithm_version
for the environment.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': 'ClassVar[str]', 'algorithm_type': 'ClassVar[str]', 'algorithm_version': <class 'str'>, 'domain': 'ClassVar[str]', 'modality': <class 'str'>, 'model_type': <class 'str'>, 'prompt': 'Union[str, Dict[str, Any]]', 'scheduler_type': <class 'str'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='DDIMGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='DiffusersGenerationAlgorithm',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='dboshardy/ddim-butterflies-128',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='vision',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'modality': Field(name='modality',type=<class 'str'>,default='image',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'model_type': Field(name='model_type',type=<class 'str'>,default='diffusion_implicit',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'prompt': Field(name='prompt',type=typing.Union[str, typing.Dict[str, typing.Any]],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Prompt for conditional generation.'}),kw_only=False,_field_type=_FIELD), 'scheduler_type': Field(name='scheduler_type',type=<class 'str'>,default='ddim',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'DDIM - Configuration to generate using a denoising diffusion implicit model.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __match_args__ = ('algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt')¶
- __module__ = 'gt4sd.algorithms.generation.diffusion.core'¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.generation.diffusion.core.DDIMGenerator'>, 'config': {'title': 'DDIMGenerator'}, 'fields': ['algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt'], 'frozen': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.generation.diffusion.core.DDIMGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.DDIMGenerator:94662818929232', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'DDIMGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'dboshardy/ddim-butterflies-128'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'modality', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'image'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'model_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'diffusion_implicit'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'scheduler_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'ddim'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'prompt', 'schema': {'type': 'default', 'schema': {'type': 'union', 'choices': [{'type': 'str'}, {'type': 'dict', 'keys_schema': {'type': 'str'}, 'values_schema': {'type': 'any'}}]}, 'default': None}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='dboshardy/ddim-butterflies-128', init=True, init_var=False, kw_only=False), 'modality': FieldInfo(annotation=str, required=False, default='image', init=True, init_var=False, kw_only=False), 'model_type': FieldInfo(annotation=str, required=False, default='diffusion_implicit', init=True, init_var=False, kw_only=False), 'prompt': FieldInfo(annotation=Union[str, Dict[str, Any]], required=False, default=None, description='Prompt for conditional generation.', init=True, init_var=False, kw_only=False), 'scheduler_type': FieldInfo(annotation=str, required=False, default='ddim', init=True, init_var=False, kw_only=False)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x0000561867b21a50, ), serializer: Fields( GeneralFieldsSerializer { fields: { "scheduler_type": SerField { key_py: Py( 0x00007f1dc5257b30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ddd7ce2b0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "modality": SerField { key_py: Py( 0x00007f1dc52551b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea8baf770, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "algorithm_version": SerField { key_py: Py( 0x00007f1dcadf4cb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dcaf2d9d0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "model_type": SerField { key_py: Py( 0x00007f1dc5255a70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dcaf2d980, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "prompt": SerField { key_py: Py( 0x00007f1dc5257ab0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x000056185a457740, ), ), serializer: Union( UnionSerializer { choices: [ Str( StrSerializer, ), Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), ], name: "Union[str, dict[str, any]]", }, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 5, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], name: "DDIMGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="DDIMGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcadf4d00, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcadf4df0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dcaf2d9d0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "modality", py_name: Py( 0x00007f1de4969070, ), init: true, init_only: false, lookup_key: Simple { key: "modality", py_key: Py( 0x00007f1dc5265ab0, ), path: LookupPath( [ S( "modality", Py( 0x00007f1dc52578b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea8baf770, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "model_type", py_name: Py( 0x00007f1ea6163a30, ), init: true, init_only: false, lookup_key: Simple { key: "model_type", py_key: Py( 0x00007f1dc5257330, ), path: LookupPath( [ S( "model_type", Py( 0x00007f1dc52572b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dcaf2d980, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "scheduler_type", py_name: Py( 0x00007f1dc51a5c30, ), init: true, init_only: false, lookup_key: Simple { key: "scheduler_type", py_key: Py( 0x00007f1dc5255730, ), path: LookupPath( [ S( "scheduler_type", Py( 0x00007f1dc5255cf0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ddd7ce2b0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "prompt", py_name: Py( 0x00007f1ea914d4b0, ), init: true, init_only: false, lookup_key: Simple { key: "prompt", py_key: Py( 0x00007f1dc5256ab0, ), path: LookupPath( [ S( "prompt", Py( 0x00007f1dc5257970, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x000056185a457740, ), ), on_error: Raise, validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, name: "dict[str,any]", }, ), None, ), ], custom_error: None, strict: false, name: "union[str,dict[str,any]]", }, ), validate_default: false, copy_default: false, name: "default[union[str,dict[str,any]]]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, ], positional_count: 5, init_only_count: None, dataclass_name: "DDIMGenerator", validator_name: "dataclass-args[DDIMGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, }, ), class: Py( 0x0000561867b21a50, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], post_init: None, revalidate: Never, name: "DDIMGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (*args: Any, algorithm_version: str = 'dboshardy/ddim-butterflies-128', modality: str = 'image', model_type: str = 'diffusion_implicit', scheduler_type: str = 'ddim', prompt: Union[str, Dict[str, Any]] = None) -> None>¶
- __wrapped__¶
alias of
DDIMGenerator
- algorithm_application: ClassVar[str] = 'DDIMGenerator'¶
Unique name for the application that is the use of this configuration together with a specific algorithm.
Will be set when registering to
ApplicationsRegistry
, but can be given by direct registration (Seeregister_algorithm_application
)
- algorithm_name: ClassVar[str] = 'DiffusersGenerationAlgorithm'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- class LDMGenerator(*args, **kwargs)[source]¶
Bases:
LDMGenerator
Unconditional Latent Diffusion Model - Configuration to generate using a latent diffusion model.
- algorithm_version: str = 'CompVis/ldm-celebahq-256'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- model_type: str = 'latent_diffusion'¶
- scheduler_type: str = 'discrete'¶
- modality: str = 'image'¶
- classmethod list_versions()[source]¶
Get possible algorithm versions.
Standard S3 and cache search adding the version used in the configuration.
- Return type
Set
[str
]- Returns
viable values as
algorithm_version
for the environment.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': 'ClassVar[str]', 'algorithm_type': 'ClassVar[str]', 'algorithm_version': <class 'str'>, 'domain': 'ClassVar[str]', 'modality': <class 'str'>, 'model_type': <class 'str'>, 'prompt': 'Union[str, Dict[str, Any]]', 'scheduler_type': <class 'str'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='LDMGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='DiffusersGenerationAlgorithm',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='CompVis/ldm-celebahq-256',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='vision',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'modality': Field(name='modality',type=<class 'str'>,default='image',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'model_type': Field(name='model_type',type=<class 'str'>,default='latent_diffusion',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'prompt': Field(name='prompt',type=typing.Union[str, typing.Dict[str, typing.Any]],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Prompt for conditional generation.'}),kw_only=False,_field_type=_FIELD), 'scheduler_type': Field(name='scheduler_type',type=<class 'str'>,default='discrete',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Unconditional Latent Diffusion Model - Configuration to generate using a latent diffusion model.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __match_args__ = ('algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt')¶
- __module__ = 'gt4sd.algorithms.generation.diffusion.core'¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.generation.diffusion.core.LDMGenerator'>, 'config': {'title': 'LDMGenerator'}, 'fields': ['algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt'], 'frozen': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.generation.diffusion.core.LDMGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.LDMGenerator:94662814447984', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'LDMGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'CompVis/ldm-celebahq-256'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'modality', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'image'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'model_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'latent_diffusion'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'scheduler_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'discrete'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'prompt', 'schema': {'type': 'default', 'schema': {'type': 'union', 'choices': [{'type': 'str'}, {'type': 'dict', 'keys_schema': {'type': 'str'}, 'values_schema': {'type': 'any'}}]}, 'default': None}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='CompVis/ldm-celebahq-256', init=True, init_var=False, kw_only=False), 'modality': FieldInfo(annotation=str, required=False, default='image', init=True, init_var=False, kw_only=False), 'model_type': FieldInfo(annotation=str, required=False, default='latent_diffusion', init=True, init_var=False, kw_only=False), 'prompt': FieldInfo(annotation=Union[str, Dict[str, Any]], required=False, default=None, description='Prompt for conditional generation.', init=True, init_var=False, kw_only=False), 'scheduler_type': FieldInfo(annotation=str, required=False, default='discrete', init=True, init_var=False, kw_only=False)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005618676db970, ), serializer: Fields( GeneralFieldsSerializer { fields: { "modality": SerField { key_py: Py( 0x00007f1dc51a7fb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea8baf770, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "algorithm_version": SerField { key_py: Py( 0x00007f1dca907b40, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dcaf2da20, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "prompt": SerField { key_py: Py( 0x00007f1dc51a7b30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x000056185a457740, ), ), serializer: Union( UnionSerializer { choices: [ Str( StrSerializer, ), Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), ], name: "Union[str, dict[str, any]]", }, ), }, ), ), required: true, }, "scheduler_type": SerField { key_py: Py( 0x00007f1dc51a7cf0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1de8e5d230, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "model_type": SerField { key_py: Py( 0x00007f1dc51a7e70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ddd491160, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 5, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], name: "LDMGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="LDMGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcabba790, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcabbb000, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dcaf2da20, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "modality", py_name: Py( 0x00007f1de4969070, ), init: true, init_only: false, lookup_key: Simple { key: "modality", py_key: Py( 0x00007f1dc51b1e70, ), path: LookupPath( [ S( "modality", Py( 0x00007f1dc507aff0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea8baf770, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "model_type", py_name: Py( 0x00007f1ea6163a30, ), init: true, init_only: false, lookup_key: Simple { key: "model_type", py_key: Py( 0x00007f1dc507afb0, ), path: LookupPath( [ S( "model_type", Py( 0x00007f1dc507aef0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ddd491160, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "scheduler_type", py_name: Py( 0x00007f1dc51a5c30, ), init: true, init_only: false, lookup_key: Simple { key: "scheduler_type", py_key: Py( 0x00007f1dc507af70, ), path: LookupPath( [ S( "scheduler_type", Py( 0x00007f1dc507b030, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1de8e5d230, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "prompt", py_name: Py( 0x00007f1ea914d4b0, ), init: true, init_only: false, lookup_key: Simple { key: "prompt", py_key: Py( 0x00007f1dc507af30, ), path: LookupPath( [ S( "prompt", Py( 0x00007f1dc507b070, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x000056185a457740, ), ), on_error: Raise, validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, name: "dict[str,any]", }, ), None, ), ], custom_error: None, strict: false, name: "union[str,dict[str,any]]", }, ), validate_default: false, copy_default: false, name: "default[union[str,dict[str,any]]]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, ], positional_count: 5, init_only_count: None, dataclass_name: "LDMGenerator", validator_name: "dataclass-args[LDMGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, }, ), class: Py( 0x00005618676db970, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], post_init: None, revalidate: Never, name: "LDMGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (*args: Any, algorithm_version: str = 'CompVis/ldm-celebahq-256', modality: str = 'image', model_type: str = 'latent_diffusion', scheduler_type: str = 'discrete', prompt: Union[str, Dict[str, Any]] = None) -> None>¶
- __wrapped__¶
alias of
LDMGenerator
- algorithm_application: ClassVar[str] = 'LDMGenerator'¶
Unique name for the application that is the use of this configuration together with a specific algorithm.
Will be set when registering to
ApplicationsRegistry
, but can be given by direct registration (Seeregister_algorithm_application
)
- algorithm_name: ClassVar[str] = 'DiffusersGenerationAlgorithm'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- class ScoreSdeGenerator(*args, **kwargs)[source]¶
Bases:
ScoreSdeGenerator
Score SDE Generative Model - Configuration to generate using a score-based diffusion generative model.
- algorithm_version: str = 'google/ncsnpp-celebahq-256'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- model_type: str = 'score_sde'¶
- scheduler_type: str = 'continuous'¶
- modality: str = 'image'¶
- classmethod list_versions()[source]¶
Get possible algorithm versions.
Standard S3 and cache search adding the version used in the configuration.
- Return type
Set
[str
]- Returns
viable values as
algorithm_version
for the environment.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': 'ClassVar[str]', 'algorithm_type': 'ClassVar[str]', 'algorithm_version': <class 'str'>, 'domain': 'ClassVar[str]', 'modality': <class 'str'>, 'model_type': <class 'str'>, 'prompt': 'Union[str, Dict[str, Any]]', 'scheduler_type': <class 'str'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='ScoreSdeGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='DiffusersGenerationAlgorithm',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='google/ncsnpp-celebahq-256',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='vision',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'modality': Field(name='modality',type=<class 'str'>,default='image',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'model_type': Field(name='model_type',type=<class 'str'>,default='score_sde',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'prompt': Field(name='prompt',type=typing.Union[str, typing.Dict[str, typing.Any]],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Prompt for conditional generation.'}),kw_only=False,_field_type=_FIELD), 'scheduler_type': Field(name='scheduler_type',type=<class 'str'>,default='continuous',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Score SDE Generative Model - Configuration to generate using a score-based diffusion generative model.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __match_args__ = ('algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt')¶
- __module__ = 'gt4sd.algorithms.generation.diffusion.core'¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.generation.diffusion.core.ScoreSdeGenerator'>, 'config': {'title': 'ScoreSdeGenerator'}, 'fields': ['algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt'], 'frozen': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.generation.diffusion.core.ScoreSdeGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.ScoreSdeGenerator:94662818776288', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'ScoreSdeGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'google/ncsnpp-celebahq-256'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'modality', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'image'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'model_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'score_sde'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'scheduler_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'continuous'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'prompt', 'schema': {'type': 'default', 'schema': {'type': 'union', 'choices': [{'type': 'str'}, {'type': 'dict', 'keys_schema': {'type': 'str'}, 'values_schema': {'type': 'any'}}]}, 'default': None}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='google/ncsnpp-celebahq-256', init=True, init_var=False, kw_only=False), 'modality': FieldInfo(annotation=str, required=False, default='image', init=True, init_var=False, kw_only=False), 'model_type': FieldInfo(annotation=str, required=False, default='score_sde', init=True, init_var=False, kw_only=False), 'prompt': FieldInfo(annotation=Union[str, Dict[str, Any]], required=False, default=None, description='Prompt for conditional generation.', init=True, init_var=False, kw_only=False), 'scheduler_type': FieldInfo(annotation=str, required=False, default='continuous', init=True, init_var=False, kw_only=False)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x0000561867afc4e0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "modality": SerField { key_py: Py( 0x00007f1dc5079530, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea8baf770, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "algorithm_version": SerField { key_py: Py( 0x00007f1dcadf5160, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dcaf2d840, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "model_type": SerField { key_py: Py( 0x00007f1dc50793b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dc51c2df0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "prompt": SerField { key_py: Py( 0x00007f1dc5079bf0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x000056185a457740, ), ), serializer: Union( UnionSerializer { choices: [ Str( StrSerializer, ), Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), ], name: "Union[str, dict[str, any]]", }, ), }, ), ), required: true, }, "scheduler_type": SerField { key_py: Py( 0x00007f1dc507a230, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea71df730, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 5, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], name: "ScoreSdeGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="ScoreSdeGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcae35840, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcae37be0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dcaf2d840, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "modality", py_name: Py( 0x00007f1de4969070, ), init: true, init_only: false, lookup_key: Simple { key: "modality", py_key: Py( 0x00007f1dc5254830, ), path: LookupPath( [ S( "modality", Py( 0x00007f1dc5080a70, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea8baf770, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "model_type", py_name: Py( 0x00007f1ea6163a30, ), init: true, init_only: false, lookup_key: Simple { key: "model_type", py_key: Py( 0x00007f1dc5080a30, ), path: LookupPath( [ S( "model_type", Py( 0x00007f1dc50809f0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dc51c2df0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "scheduler_type", py_name: Py( 0x00007f1dc51a5c30, ), init: true, init_only: false, lookup_key: Simple { key: "scheduler_type", py_key: Py( 0x00007f1dc5080ab0, ), path: LookupPath( [ S( "scheduler_type", Py( 0x00007f1dc5080af0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea71df730, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "prompt", py_name: Py( 0x00007f1ea914d4b0, ), init: true, init_only: false, lookup_key: Simple { key: "prompt", py_key: Py( 0x00007f1dc5080b30, ), path: LookupPath( [ S( "prompt", Py( 0x00007f1dc5080b70, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x000056185a457740, ), ), on_error: Raise, validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, name: "dict[str,any]", }, ), None, ), ], custom_error: None, strict: false, name: "union[str,dict[str,any]]", }, ), validate_default: false, copy_default: false, name: "default[union[str,dict[str,any]]]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, ], positional_count: 5, init_only_count: None, dataclass_name: "ScoreSdeGenerator", validator_name: "dataclass-args[ScoreSdeGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, }, ), class: Py( 0x0000561867afc4e0, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], post_init: None, revalidate: Never, name: "ScoreSdeGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (*args: Any, algorithm_version: str = 'google/ncsnpp-celebahq-256', modality: str = 'image', model_type: str = 'score_sde', scheduler_type: str = 'continuous', prompt: Union[str, Dict[str, Any]] = None) -> None>¶
- __wrapped__¶
alias of
ScoreSdeGenerator
- algorithm_application: ClassVar[str] = 'ScoreSdeGenerator'¶
Unique name for the application that is the use of this configuration together with a specific algorithm.
Will be set when registering to
ApplicationsRegistry
, but can be given by direct registration (Seeregister_algorithm_application
)
- algorithm_name: ClassVar[str] = 'DiffusersGenerationAlgorithm'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- class LDMTextToImageGenerator(*args, **kwargs)[source]¶
Bases:
LDMTextToImageGenerator
Conditional Latent Diffusion Model - Configuration for conditional text2image generation using a latent diffusion model.
- algorithm_version: str = 'CompVis/ldm-text2im-large-256'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- model_type: str = 'latent_diffusion_conditional'¶
- scheduler_type: str = 'discrete'¶
- modality: str = 'token2image'¶
- classmethod list_versions()[source]¶
Get possible algorithm versions.
Standard S3 and cache search adding the version used in the configuration.
- Return type
Set
[str
]- Returns
viable values as
algorithm_version
for the environment.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': 'ClassVar[str]', 'algorithm_type': 'ClassVar[str]', 'algorithm_version': <class 'str'>, 'domain': 'ClassVar[str]', 'modality': <class 'str'>, 'model_type': <class 'str'>, 'prompt': 'Union[str, Dict[str, Any]]', 'scheduler_type': <class 'str'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='LDMTextToImageGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='DiffusersGenerationAlgorithm',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='CompVis/ldm-text2im-large-256',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='vision',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'modality': Field(name='modality',type=<class 'str'>,default='token2image',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'model_type': Field(name='model_type',type=<class 'str'>,default='latent_diffusion_conditional',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'prompt': Field(name='prompt',type=typing.Union[str, typing.Dict[str, typing.Any]],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Prompt for conditional generation.'}),kw_only=False,_field_type=_FIELD), 'scheduler_type': Field(name='scheduler_type',type=<class 'str'>,default='discrete',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Conditional Latent Diffusion Model - Configuration for conditional text2image generation using a latent diffusion model.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __match_args__ = ('algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt')¶
- __module__ = 'gt4sd.algorithms.generation.diffusion.core'¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.generation.diffusion.core.LDMTextToImageGenerator'>, 'config': {'title': 'LDMTextToImageGenerator'}, 'fields': ['algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt'], 'frozen': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.generation.diffusion.core.LDMTextToImageGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.LDMTextToImageGenerator:94662818965024', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'LDMTextToImageGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'CompVis/ldm-text2im-large-256'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'modality', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'token2image'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'model_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'latent_diffusion_conditional'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'scheduler_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'discrete'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'prompt', 'schema': {'type': 'default', 'schema': {'type': 'union', 'choices': [{'type': 'str'}, {'type': 'dict', 'keys_schema': {'type': 'str'}, 'values_schema': {'type': 'any'}}]}, 'default': None}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='CompVis/ldm-text2im-large-256', init=True, init_var=False, kw_only=False), 'modality': FieldInfo(annotation=str, required=False, default='token2image', init=True, init_var=False, kw_only=False), 'model_type': FieldInfo(annotation=str, required=False, default='latent_diffusion_conditional', init=True, init_var=False, kw_only=False), 'prompt': FieldInfo(annotation=Union[str, Dict[str, Any]], required=False, default=None, description='Prompt for conditional generation.', init=True, init_var=False, kw_only=False), 'scheduler_type': FieldInfo(annotation=str, required=False, default='discrete', init=True, init_var=False, kw_only=False)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x0000561867b2a620, ), serializer: Fields( GeneralFieldsSerializer { fields: { "modality": SerField { key_py: Py( 0x00007f1dc5082a30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dc51c2e30, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "prompt": SerField { key_py: Py( 0x00007f1dc5082970, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x000056185a457740, ), ), serializer: Union( UnionSerializer { choices: [ Str( StrSerializer, ), Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), ], name: "Union[str, dict[str, any]]", }, ), }, ), ), required: true, }, "model_type": SerField { key_py: Py( 0x00007f1dc50829f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dcaf2d610, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "scheduler_type": SerField { key_py: Py( 0x00007f1dc50829b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1de8e5d230, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "algorithm_version": SerField { key_py: Py( 0x00007f1dcae6baa0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dcaf2d8e0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 5, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], name: "LDMTextToImageGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="LDMTextToImageGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcae69610, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcae6ba00, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dcaf2d8e0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "modality", py_name: Py( 0x00007f1de4969070, ), init: true, init_only: false, lookup_key: Simple { key: "modality", py_key: Py( 0x00007f1dc5083fb0, ), path: LookupPath( [ S( "modality", Py( 0x00007f1dc5081c70, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dc51c2e30, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "model_type", py_name: Py( 0x00007f1ea6163a30, ), init: true, init_only: false, lookup_key: Simple { key: "model_type", py_key: Py( 0x00007f1dc5090070, ), path: LookupPath( [ S( "model_type", Py( 0x00007f1dc5090030, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dcaf2d610, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "scheduler_type", py_name: Py( 0x00007f1dc51a5c30, ), init: true, init_only: false, lookup_key: Simple { key: "scheduler_type", py_key: Py( 0x00007f1dc50900b0, ), path: LookupPath( [ S( "scheduler_type", Py( 0x00007f1dc50900f0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1de8e5d230, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "prompt", py_name: Py( 0x00007f1ea914d4b0, ), init: true, init_only: false, lookup_key: Simple { key: "prompt", py_key: Py( 0x00007f1dc5090130, ), path: LookupPath( [ S( "prompt", Py( 0x00007f1dc5090170, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x000056185a457740, ), ), on_error: Raise, validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, name: "dict[str,any]", }, ), None, ), ], custom_error: None, strict: false, name: "union[str,dict[str,any]]", }, ), validate_default: false, copy_default: false, name: "default[union[str,dict[str,any]]]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, ], positional_count: 5, init_only_count: None, dataclass_name: "LDMTextToImageGenerator", validator_name: "dataclass-args[LDMTextToImageGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, }, ), class: Py( 0x0000561867b2a620, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], post_init: None, revalidate: Never, name: "LDMTextToImageGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (*args: Any, algorithm_version: str = 'CompVis/ldm-text2im-large-256', modality: str = 'token2image', model_type: str = 'latent_diffusion_conditional', scheduler_type: str = 'discrete', prompt: Union[str, Dict[str, Any]] = None) -> None>¶
- __wrapped__¶
alias of
LDMTextToImageGenerator
- algorithm_application: ClassVar[str] = 'LDMTextToImageGenerator'¶
Unique name for the application that is the use of this configuration together with a specific algorithm.
Will be set when registering to
ApplicationsRegistry
, but can be given by direct registration (Seeregister_algorithm_application
)
- algorithm_name: ClassVar[str] = 'DiffusersGenerationAlgorithm'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- class StableDiffusionGenerator(*args, **kwargs)[source]¶
Bases:
StableDiffusionGenerator
Stable Diffusion Model - Configuration for conditional text2image generation using a stable diffusion model. You have to provide authentication credentials to use this model.
- algorithm_version: str = 'CompVis/stable-diffusion-v1-4'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- model_type: str = 'stable_diffusion'¶
- scheduler_type: str = 'discrete'¶
- modality: str = 'token2image'¶
- classmethod list_versions()[source]¶
Get possible algorithm versions.
Standard S3 and cache search adding the version used in the configuration.
- Return type
Set
[str
]- Returns
viable values as
algorithm_version
for the environment.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': 'ClassVar[str]', 'algorithm_type': 'ClassVar[str]', 'algorithm_version': <class 'str'>, 'domain': 'ClassVar[str]', 'modality': <class 'str'>, 'model_type': <class 'str'>, 'prompt': 'Union[str, Dict[str, Any]]', 'scheduler_type': <class 'str'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='StableDiffusionGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='DiffusersGenerationAlgorithm',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='CompVis/stable-diffusion-v1-4',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='vision',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'modality': Field(name='modality',type=<class 'str'>,default='token2image',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'model_type': Field(name='model_type',type=<class 'str'>,default='stable_diffusion',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'prompt': Field(name='prompt',type=typing.Union[str, typing.Dict[str, typing.Any]],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Prompt for conditional generation.'}),kw_only=False,_field_type=_FIELD), 'scheduler_type': Field(name='scheduler_type',type=<class 'str'>,default='discrete',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Stable Diffusion Model - Configuration for conditional text2image generation using a stable diffusion model.\n You have to provide authentication credentials to use this model.\n '¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __match_args__ = ('algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt')¶
- __module__ = 'gt4sd.algorithms.generation.diffusion.core'¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.generation.diffusion.core.StableDiffusionGenerator'>, 'config': {'title': 'StableDiffusionGenerator'}, 'fields': ['algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt'], 'frozen': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.generation.diffusion.core.StableDiffusionGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.StableDiffusionGenerator:94662819024944', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'StableDiffusionGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'CompVis/stable-diffusion-v1-4'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'modality', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'token2image'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'model_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'stable_diffusion'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'scheduler_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'discrete'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'prompt', 'schema': {'type': 'default', 'schema': {'type': 'union', 'choices': [{'type': 'str'}, {'type': 'dict', 'keys_schema': {'type': 'str'}, 'values_schema': {'type': 'any'}}]}, 'default': None}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='CompVis/stable-diffusion-v1-4', init=True, init_var=False, kw_only=False), 'modality': FieldInfo(annotation=str, required=False, default='token2image', init=True, init_var=False, kw_only=False), 'model_type': FieldInfo(annotation=str, required=False, default='stable_diffusion', init=True, init_var=False, kw_only=False), 'prompt': FieldInfo(annotation=Union[str, Dict[str, Any]], required=False, default=None, description='Prompt for conditional generation.', init=True, init_var=False, kw_only=False), 'scheduler_type': FieldInfo(annotation=str, required=False, default='discrete', init=True, init_var=False, kw_only=False)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x0000561867b39030, ), serializer: Fields( GeneralFieldsSerializer { fields: { "algorithm_version": SerField { key_py: Py( 0x00007f1dcae687b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dcaf2d5c0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "scheduler_type": SerField { key_py: Py( 0x00007f1dc51b1870, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1de8e5d230, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "model_type": SerField { key_py: Py( 0x00007f1dc51b20f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ddd4911b0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "prompt": SerField { key_py: Py( 0x00007f1dc51b2630, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x000056185a457740, ), ), serializer: Union( UnionSerializer { choices: [ Str( StrSerializer, ), Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), ], name: "Union[str, dict[str, any]]", }, ), }, ), ), required: true, }, "modality": SerField { key_py: Py( 0x00007f1dc51b1ab0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dc51c2e30, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 5, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], name: "StableDiffusionGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="StableDiffusionGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dca9b8300, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dca9b80d0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dcaf2d5c0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "modality", py_name: Py( 0x00007f1de4969070, ), init: true, init_only: false, lookup_key: Simple { key: "modality", py_key: Py( 0x00007f1dc50821f0, ), path: LookupPath( [ S( "modality", Py( 0x00007f1dc5090db0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dc51c2e30, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "model_type", py_name: Py( 0x00007f1ea6163a30, ), init: true, init_only: false, lookup_key: Simple { key: "model_type", py_key: Py( 0x00007f1dc5090d70, ), path: LookupPath( [ S( "model_type", Py( 0x00007f1dc5090d30, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ddd4911b0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "scheduler_type", py_name: Py( 0x00007f1dc51a5c30, ), init: true, init_only: false, lookup_key: Simple { key: "scheduler_type", py_key: Py( 0x00007f1dc5090df0, ), path: LookupPath( [ S( "scheduler_type", Py( 0x00007f1dc5090e30, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1de8e5d230, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "prompt", py_name: Py( 0x00007f1ea914d4b0, ), init: true, init_only: false, lookup_key: Simple { key: "prompt", py_key: Py( 0x00007f1dc5090e70, ), path: LookupPath( [ S( "prompt", Py( 0x00007f1dc5090eb0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x000056185a457740, ), ), on_error: Raise, validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, name: "dict[str,any]", }, ), None, ), ], custom_error: None, strict: false, name: "union[str,dict[str,any]]", }, ), validate_default: false, copy_default: false, name: "default[union[str,dict[str,any]]]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, ], positional_count: 5, init_only_count: None, dataclass_name: "StableDiffusionGenerator", validator_name: "dataclass-args[StableDiffusionGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, }, ), class: Py( 0x0000561867b39030, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], post_init: None, revalidate: Never, name: "StableDiffusionGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (*args: Any, algorithm_version: str = 'CompVis/stable-diffusion-v1-4', modality: str = 'token2image', model_type: str = 'stable_diffusion', scheduler_type: str = 'discrete', prompt: Union[str, Dict[str, Any]] = None) -> None>¶
- __wrapped__¶
alias of
StableDiffusionGenerator
- algorithm_application: ClassVar[str] = 'StableDiffusionGenerator'¶
Unique name for the application that is the use of this configuration together with a specific algorithm.
Will be set when registering to
ApplicationsRegistry
, but can be given by direct registration (Seeregister_algorithm_application
)
- algorithm_name: ClassVar[str] = 'DiffusersGenerationAlgorithm'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- class GeoDiffGenerator(*args, **kwargs)[source]¶
Bases:
GeoDiffGenerator
GeoDiff Diffusion Model - Configuration for conditional 3D molecule structure generation given 2D information using a GeoDiff diffusion model.
- algorithm_version: str = 'fusing/gfn-molecule-gen-drugs'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- model_type: str = 'geodiff'¶
- scheduler_type: str = 'ddpm'¶
- modality: str = 'molecule'¶
- classmethod list_versions()[source]¶
Get possible algorithm versions.
Standard S3 and cache search adding the version used in the configuration.
- Return type
Set
[str
]- Returns
viable values as
algorithm_version
for the environment.
- get_target_description()[source]¶
Get description of the target for generation.
- Return type
Optional
[Dict
[str
,str
],None
]- Returns
target description, returns None in case no target is used.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': 'ClassVar[str]', 'algorithm_type': 'ClassVar[str]', 'algorithm_version': <class 'str'>, 'domain': 'ClassVar[str]', 'modality': <class 'str'>, 'model_type': <class 'str'>, 'prompt': 'Union[str, Dict[str, Any]]', 'scheduler_type': <class 'str'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='GeoDiffGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='DiffusersGenerationAlgorithm',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='fusing/gfn-molecule-gen-drugs',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='vision',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'modality': Field(name='modality',type=<class 'str'>,default='molecule',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'model_type': Field(name='model_type',type=<class 'str'>,default='geodiff',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'prompt': Field(name='prompt',type=typing.Union[str, typing.Dict[str, typing.Any]],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Prompt for conditional generation.'}),kw_only=False,_field_type=_FIELD), 'scheduler_type': Field(name='scheduler_type',type=<class 'str'>,default='ddpm',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'GeoDiff Diffusion Model - Configuration for conditional 3D molecule structure generation given 2D information using a GeoDiff diffusion model.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __match_args__ = ('algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt')¶
- __module__ = 'gt4sd.algorithms.generation.diffusion.core'¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.generation.diffusion.core.GeoDiffGenerator'>, 'config': {'title': 'GeoDiffGenerator'}, 'fields': ['algorithm_version', 'modality', 'model_type', 'scheduler_type', 'prompt'], 'frozen': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.generation.diffusion.core.GeoDiffGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.GeoDiffGenerator:94662819010336', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'GeoDiffGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'fusing/gfn-molecule-gen-drugs'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'modality', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'molecule'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'model_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'geodiff'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'scheduler_type', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'ddpm'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'prompt', 'schema': {'type': 'default', 'schema': {'type': 'union', 'choices': [{'type': 'str'}, {'type': 'dict', 'keys_schema': {'type': 'str'}, 'values_schema': {'type': 'any'}}]}, 'default': None}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='fusing/gfn-molecule-gen-drugs', init=True, init_var=False, kw_only=False), 'modality': FieldInfo(annotation=str, required=False, default='molecule', init=True, init_var=False, kw_only=False), 'model_type': FieldInfo(annotation=str, required=False, default='geodiff', init=True, init_var=False, kw_only=False), 'prompt': FieldInfo(annotation=Union[str, Dict[str, Any]], required=False, default=None, description='Prompt for conditional generation.', init=True, init_var=False, kw_only=False), 'scheduler_type': FieldInfo(annotation=str, required=False, default='ddpm', init=True, init_var=False, kw_only=False)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x0000561867b35720, ), serializer: Fields( GeneralFieldsSerializer { fields: { "scheduler_type": SerField { key_py: Py( 0x00007f1dc51a6eb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ddd49c030, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "prompt": SerField { key_py: Py( 0x00007f1dc51a74f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x000056185a457740, ), ), serializer: Union( UnionSerializer { choices: [ Str( StrSerializer, ), Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), ], name: "Union[str, dict[str, any]]", }, ), }, ), ), required: true, }, "modality": SerField { key_py: Py( 0x00007f1dc51a4530, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea52cc5f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "algorithm_version": SerField { key_py: Py( 0x00007f1dcab9f050, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dcaf2d570, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "model_type": SerField { key_py: Py( 0x00007f1dc51a76b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1dc51c2eb0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 5, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], name: "GeoDiffGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="GeoDiffGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcae6a100, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcab9e5b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dcaf2d570, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "modality", py_name: Py( 0x00007f1de4969070, ), init: true, init_only: false, lookup_key: Simple { key: "modality", py_key: Py( 0x00007f1dc507aab0, ), path: LookupPath( [ S( "modality", Py( 0x00007f1dc5078770, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea52cc5f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "model_type", py_name: Py( 0x00007f1ea6163a30, ), init: true, init_only: false, lookup_key: Simple { key: "model_type", py_key: Py( 0x00007f1dc50791f0, ), path: LookupPath( [ S( "model_type", Py( 0x00007f1dc50794b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1dc51c2eb0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "scheduler_type", py_name: Py( 0x00007f1dc51a5c30, ), init: true, init_only: false, lookup_key: Simple { key: "scheduler_type", py_key: Py( 0x00007f1dcaa9a2b0, ), path: LookupPath( [ S( "scheduler_type", Py( 0x00007f1dcaa9a730, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ddd49c030, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "prompt", py_name: Py( 0x00007f1ea914d4b0, ), init: true, init_only: false, lookup_key: Simple { key: "prompt", py_key: Py( 0x00007f1dc51a6ff0, ), path: LookupPath( [ S( "prompt", Py( 0x00007f1dc51a63f0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x000056185a457740, ), ), on_error: Raise, validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, name: "dict[str,any]", }, ), None, ), ], custom_error: None, strict: false, name: "union[str,dict[str,any]]", }, ), validate_default: false, copy_default: false, name: "default[union[str,dict[str,any]]]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, ], positional_count: 5, init_only_count: None, dataclass_name: "GeoDiffGenerator", validator_name: "dataclass-args[GeoDiffGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, }, ), class: Py( 0x0000561867b35720, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1de4969070, ), Py( 0x00007f1ea6163a30, ), Py( 0x00007f1dc51a5c30, ), Py( 0x00007f1ea914d4b0, ), ], post_init: None, revalidate: Never, name: "GeoDiffGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (*args: Any, algorithm_version: str = 'fusing/gfn-molecule-gen-drugs', modality: str = 'molecule', model_type: str = 'geodiff', scheduler_type: str = 'ddpm', prompt: Union[str, Dict[str, Any]] = None) -> None>¶
- __wrapped__¶
alias of
GeoDiffGenerator
- algorithm_application: ClassVar[str] = 'GeoDiffGenerator'¶
Unique name for the application that is the use of this configuration together with a specific algorithm.
Will be set when registering to
ApplicationsRegistry
, but can be given by direct registration (Seeregister_algorithm_application
)
- algorithm_name: ClassVar[str] = 'DiffusersGenerationAlgorithm'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry