Perceiver3D#
- pydantic model vision_architectures.nets.perceiver_3d.Perceiver3DChannelMappingConfig[source]#
Bases:
CustomBaseModel
Show JSON schema
{ "title": "Perceiver3DChannelMappingConfig", "type": "object", "properties": { "in_channels": { "anyOf": [ { "type": "integer" }, { "items": { "type": "integer" }, "type": "array", "uniqueItems": true } ], "title": "In Channels" }, "out_channels": { "title": "Out Channels", "type": "integer" } }, "required": [ "in_channels", "out_channels" ] }
- Config:
arbitrary_types_allowed: bool = True
extra: str = ignore
validate_default: bool = True
validate_assignment: bool = True
validate_return: bool = True
- Fields:
- Validators:
-
field in_channels:
int
|set
[int
] [Required]# - Validated by:
-
field out_channels:
int
[Required]# - Validated by:
- pydantic model vision_architectures.nets.perceiver_3d.Perceiver3DEncoderEncodeConfig[source]#
Bases:
Attention3DWithMLPConfig
Show JSON schema
{ "title": "Perceiver3DEncoderEncodeConfig", "type": "object", "properties": { "dim": { "title": "Dim", "type": "integer" }, "mlp_ratio": { "default": 4, "title": "Mlp Ratio", "type": "integer" }, "activation": { "default": "gelu", "title": "Activation", "type": "string" }, "mlp_drop_prob": { "default": 0.0, "title": "Mlp Drop Prob", "type": "number" }, "num_heads": { "description": "Number of query heads", "title": "Num Heads", "type": "integer" }, "ratio_q_to_kv_heads": { "default": 1, "title": "Ratio Q To Kv Heads", "type": "integer" }, "logit_scale_learnable": { "default": false, "title": "Logit Scale Learnable", "type": "boolean" }, "attn_drop_prob": { "default": 0.0, "title": "Attn Drop Prob", "type": "number" }, "proj_drop_prob": { "default": 0.0, "title": "Proj Drop Prob", "type": "number" }, "max_attention_batch_size": { "default": -1, "description": "Runs attention by splitting the inputs into chunks of this size. 0 means no chunking. Useful for large inputs during inference.", "title": "Max Attention Batch Size", "type": "integer" }, "norm_location": { "default": "post", "enum": [ "pre", "post" ], "title": "Norm Location", "type": "string" }, "layer_norm_eps": { "default": 1e-06, "title": "Layer Norm Eps", "type": "number" }, "num_layers": { "title": "Num Layers", "type": "integer" }, "latent_grid_size": { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "title": "Latent Grid Size", "type": "array" } }, "required": [ "dim", "num_heads", "num_layers", "latent_grid_size" ] }
- Config:
arbitrary_types_allowed: bool = True
extra: str = ignore
validate_default: bool = True
validate_assignment: bool = True
validate_return: bool = True
- Fields:
- Validators:
-
field dim:
int
[Required]# - Validated by:
-
field num_layers:
int
[Required]# - Validated by:
-
field latent_grid_size:
tuple
[int
,int
,int
] [Required]# - Validated by:
- pydantic model vision_architectures.nets.perceiver_3d.Perceiver3DEncoderProcessConfig[source]#
Bases:
Attention3DWithMLPConfig
Show JSON schema
{ "title": "Perceiver3DEncoderProcessConfig", "type": "object", "properties": { "dim": { "title": "Dim", "type": "integer" }, "mlp_ratio": { "default": 4, "title": "Mlp Ratio", "type": "integer" }, "activation": { "default": "gelu", "title": "Activation", "type": "string" }, "mlp_drop_prob": { "default": 0.0, "title": "Mlp Drop Prob", "type": "number" }, "num_heads": { "description": "Number of query heads", "title": "Num Heads", "type": "integer" }, "ratio_q_to_kv_heads": { "default": 1, "title": "Ratio Q To Kv Heads", "type": "integer" }, "logit_scale_learnable": { "default": false, "title": "Logit Scale Learnable", "type": "boolean" }, "attn_drop_prob": { "default": 0.0, "title": "Attn Drop Prob", "type": "number" }, "proj_drop_prob": { "default": 0.0, "title": "Proj Drop Prob", "type": "number" }, "max_attention_batch_size": { "default": -1, "description": "Runs attention by splitting the inputs into chunks of this size. 0 means no chunking. Useful for large inputs during inference.", "title": "Max Attention Batch Size", "type": "integer" }, "norm_location": { "default": "post", "enum": [ "pre", "post" ], "title": "Norm Location", "type": "string" }, "layer_norm_eps": { "default": 1e-06, "title": "Layer Norm Eps", "type": "number" }, "num_layers": { "title": "Num Layers", "type": "integer" }, "latent_grid_size": { "anyOf": [ { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "type": "null" } ], "title": "Latent Grid Size" }, "use_relative_position_embeddings": { "default": true, "title": "Use Relative Position Embeddings", "type": "boolean" } }, "required": [ "dim", "num_heads", "num_layers", "latent_grid_size" ] }
- Config:
arbitrary_types_allowed: bool = True
extra: str = ignore
validate_default: bool = True
validate_assignment: bool = True
validate_return: bool = True
- Fields:
- Validators:
validate
»all fields
-
field dim:
int
[Required]# - Validated by:
-
field num_layers:
int
[Required]# - Validated by:
-
field latent_grid_size:
tuple
[int
,int
,int
] |None
[Required]# - Validated by:
-
field use_relative_position_embeddings:
bool
= True# - Validated by:
- pydantic model vision_architectures.nets.perceiver_3d.Perceiver3DEncoderConfig[source]#
Bases:
CustomBaseModel
Show JSON schema
{ "title": "Perceiver3DEncoderConfig", "type": "object", "properties": { "encode": { "$ref": "#/$defs/Perceiver3DEncoderEncodeConfig" }, "process": { "$ref": "#/$defs/Perceiver3DEncoderProcessConfig" } }, "$defs": { "Perceiver3DEncoderEncodeConfig": { "properties": { "dim": { "title": "Dim", "type": "integer" }, "mlp_ratio": { "default": 4, "title": "Mlp Ratio", "type": "integer" }, "activation": { "default": "gelu", "title": "Activation", "type": "string" }, "mlp_drop_prob": { "default": 0.0, "title": "Mlp Drop Prob", "type": "number" }, "num_heads": { "description": "Number of query heads", "title": "Num Heads", "type": "integer" }, "ratio_q_to_kv_heads": { "default": 1, "title": "Ratio Q To Kv Heads", "type": "integer" }, "logit_scale_learnable": { "default": false, "title": "Logit Scale Learnable", "type": "boolean" }, "attn_drop_prob": { "default": 0.0, "title": "Attn Drop Prob", "type": "number" }, "proj_drop_prob": { "default": 0.0, "title": "Proj Drop Prob", "type": "number" }, "max_attention_batch_size": { "default": -1, "description": "Runs attention by splitting the inputs into chunks of this size. 0 means no chunking. Useful for large inputs during inference.", "title": "Max Attention Batch Size", "type": "integer" }, "norm_location": { "default": "post", "enum": [ "pre", "post" ], "title": "Norm Location", "type": "string" }, "layer_norm_eps": { "default": 1e-06, "title": "Layer Norm Eps", "type": "number" }, "num_layers": { "title": "Num Layers", "type": "integer" }, "latent_grid_size": { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "title": "Latent Grid Size", "type": "array" } }, "required": [ "dim", "num_heads", "num_layers", "latent_grid_size" ], "title": "Perceiver3DEncoderEncodeConfig", "type": "object" }, "Perceiver3DEncoderProcessConfig": { "properties": { "dim": { "title": "Dim", "type": "integer" }, "mlp_ratio": { "default": 4, "title": "Mlp Ratio", "type": "integer" }, "activation": { "default": "gelu", "title": "Activation", "type": "string" }, "mlp_drop_prob": { "default": 0.0, "title": "Mlp Drop Prob", "type": "number" }, "num_heads": { "description": "Number of query heads", "title": "Num Heads", "type": "integer" }, "ratio_q_to_kv_heads": { "default": 1, "title": "Ratio Q To Kv Heads", "type": "integer" }, "logit_scale_learnable": { "default": false, "title": "Logit Scale Learnable", "type": "boolean" }, "attn_drop_prob": { "default": 0.0, "title": "Attn Drop Prob", "type": "number" }, "proj_drop_prob": { "default": 0.0, "title": "Proj Drop Prob", "type": "number" }, "max_attention_batch_size": { "default": -1, "description": "Runs attention by splitting the inputs into chunks of this size. 0 means no chunking. Useful for large inputs during inference.", "title": "Max Attention Batch Size", "type": "integer" }, "norm_location": { "default": "post", "enum": [ "pre", "post" ], "title": "Norm Location", "type": "string" }, "layer_norm_eps": { "default": 1e-06, "title": "Layer Norm Eps", "type": "number" }, "num_layers": { "title": "Num Layers", "type": "integer" }, "latent_grid_size": { "anyOf": [ { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "type": "null" } ], "title": "Latent Grid Size" }, "use_relative_position_embeddings": { "default": true, "title": "Use Relative Position Embeddings", "type": "boolean" } }, "required": [ "dim", "num_heads", "num_layers", "latent_grid_size" ], "title": "Perceiver3DEncoderProcessConfig", "type": "object" } }, "required": [ "encode", "process" ] }
- Config:
arbitrary_types_allowed: bool = True
extra: str = ignore
validate_default: bool = True
validate_assignment: bool = True
validate_return: bool = True
- Fields:
- Validators:
validate
»all fields
validate_before
»all fields
-
field encode:
Perceiver3DEncoderEncodeConfig
[Required]# - Validated by:
-
field process:
Perceiver3DEncoderProcessConfig
[Required]# - Validated by:
- property dim#
- property latent_grid_size#
- pydantic model vision_architectures.nets.perceiver_3d.Perceiver3DDecoderConfig[source]#
Bases:
Attention3DWithMLPConfig
Show JSON schema
{ "title": "Perceiver3DDecoderConfig", "type": "object", "properties": { "dim": { "title": "Dim", "type": "integer" }, "mlp_ratio": { "default": 4, "title": "Mlp Ratio", "type": "integer" }, "activation": { "default": "gelu", "title": "Activation", "type": "string" }, "mlp_drop_prob": { "default": 0.0, "title": "Mlp Drop Prob", "type": "number" }, "num_heads": { "description": "Number of query heads", "title": "Num Heads", "type": "integer" }, "ratio_q_to_kv_heads": { "default": 1, "title": "Ratio Q To Kv Heads", "type": "integer" }, "logit_scale_learnable": { "default": false, "title": "Logit Scale Learnable", "type": "boolean" }, "attn_drop_prob": { "default": 0.0, "title": "Attn Drop Prob", "type": "number" }, "proj_drop_prob": { "default": 0.0, "title": "Proj Drop Prob", "type": "number" }, "max_attention_batch_size": { "default": -1, "description": "Runs attention by splitting the inputs into chunks of this size. 0 means no chunking. Useful for large inputs during inference.", "title": "Max Attention Batch Size", "type": "integer" }, "norm_location": { "default": "post", "enum": [ "pre", "post" ], "title": "Norm Location", "type": "string" }, "layer_norm_eps": { "default": 1e-06, "title": "Layer Norm Eps", "type": "number" }, "num_layers": { "title": "Num Layers", "type": "integer" }, "out_channels": { "title": "Out Channels", "type": "integer" }, "use_absolute_position_embeddings": { "default": true, "title": "Use Absolute Position Embeddings", "type": "boolean" } }, "required": [ "dim", "num_heads", "num_layers", "out_channels" ] }
- Config:
arbitrary_types_allowed: bool = True
extra: str = ignore
validate_default: bool = True
validate_assignment: bool = True
validate_return: bool = True
- Fields:
- Validators:
-
field dim:
int
[Required]# - Validated by:
-
field num_layers:
int
[Required]# - Validated by:
-
field out_channels:
int
[Required]# - Validated by:
-
field use_absolute_position_embeddings:
bool
= True# - Validated by:
- pydantic model vision_architectures.nets.perceiver_3d.Perceiver3DConfig[source]#
Bases:
Perceiver3DEncoderConfig
Show JSON schema
{ "title": "Perceiver3DConfig", "type": "object", "properties": { "encode": { "$ref": "#/$defs/Perceiver3DEncoderEncodeConfig" }, "process": { "$ref": "#/$defs/Perceiver3DEncoderProcessConfig" }, "decode": { "$ref": "#/$defs/Perceiver3DDecoderConfig" } }, "$defs": { "Perceiver3DDecoderConfig": { "properties": { "dim": { "title": "Dim", "type": "integer" }, "mlp_ratio": { "default": 4, "title": "Mlp Ratio", "type": "integer" }, "activation": { "default": "gelu", "title": "Activation", "type": "string" }, "mlp_drop_prob": { "default": 0.0, "title": "Mlp Drop Prob", "type": "number" }, "num_heads": { "description": "Number of query heads", "title": "Num Heads", "type": "integer" }, "ratio_q_to_kv_heads": { "default": 1, "title": "Ratio Q To Kv Heads", "type": "integer" }, "logit_scale_learnable": { "default": false, "title": "Logit Scale Learnable", "type": "boolean" }, "attn_drop_prob": { "default": 0.0, "title": "Attn Drop Prob", "type": "number" }, "proj_drop_prob": { "default": 0.0, "title": "Proj Drop Prob", "type": "number" }, "max_attention_batch_size": { "default": -1, "description": "Runs attention by splitting the inputs into chunks of this size. 0 means no chunking. Useful for large inputs during inference.", "title": "Max Attention Batch Size", "type": "integer" }, "norm_location": { "default": "post", "enum": [ "pre", "post" ], "title": "Norm Location", "type": "string" }, "layer_norm_eps": { "default": 1e-06, "title": "Layer Norm Eps", "type": "number" }, "num_layers": { "title": "Num Layers", "type": "integer" }, "out_channels": { "title": "Out Channels", "type": "integer" }, "use_absolute_position_embeddings": { "default": true, "title": "Use Absolute Position Embeddings", "type": "boolean" } }, "required": [ "dim", "num_heads", "num_layers", "out_channels" ], "title": "Perceiver3DDecoderConfig", "type": "object" }, "Perceiver3DEncoderEncodeConfig": { "properties": { "dim": { "title": "Dim", "type": "integer" }, "mlp_ratio": { "default": 4, "title": "Mlp Ratio", "type": "integer" }, "activation": { "default": "gelu", "title": "Activation", "type": "string" }, "mlp_drop_prob": { "default": 0.0, "title": "Mlp Drop Prob", "type": "number" }, "num_heads": { "description": "Number of query heads", "title": "Num Heads", "type": "integer" }, "ratio_q_to_kv_heads": { "default": 1, "title": "Ratio Q To Kv Heads", "type": "integer" }, "logit_scale_learnable": { "default": false, "title": "Logit Scale Learnable", "type": "boolean" }, "attn_drop_prob": { "default": 0.0, "title": "Attn Drop Prob", "type": "number" }, "proj_drop_prob": { "default": 0.0, "title": "Proj Drop Prob", "type": "number" }, "max_attention_batch_size": { "default": -1, "description": "Runs attention by splitting the inputs into chunks of this size. 0 means no chunking. Useful for large inputs during inference.", "title": "Max Attention Batch Size", "type": "integer" }, "norm_location": { "default": "post", "enum": [ "pre", "post" ], "title": "Norm Location", "type": "string" }, "layer_norm_eps": { "default": 1e-06, "title": "Layer Norm Eps", "type": "number" }, "num_layers": { "title": "Num Layers", "type": "integer" }, "latent_grid_size": { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "title": "Latent Grid Size", "type": "array" } }, "required": [ "dim", "num_heads", "num_layers", "latent_grid_size" ], "title": "Perceiver3DEncoderEncodeConfig", "type": "object" }, "Perceiver3DEncoderProcessConfig": { "properties": { "dim": { "title": "Dim", "type": "integer" }, "mlp_ratio": { "default": 4, "title": "Mlp Ratio", "type": "integer" }, "activation": { "default": "gelu", "title": "Activation", "type": "string" }, "mlp_drop_prob": { "default": 0.0, "title": "Mlp Drop Prob", "type": "number" }, "num_heads": { "description": "Number of query heads", "title": "Num Heads", "type": "integer" }, "ratio_q_to_kv_heads": { "default": 1, "title": "Ratio Q To Kv Heads", "type": "integer" }, "logit_scale_learnable": { "default": false, "title": "Logit Scale Learnable", "type": "boolean" }, "attn_drop_prob": { "default": 0.0, "title": "Attn Drop Prob", "type": "number" }, "proj_drop_prob": { "default": 0.0, "title": "Proj Drop Prob", "type": "number" }, "max_attention_batch_size": { "default": -1, "description": "Runs attention by splitting the inputs into chunks of this size. 0 means no chunking. Useful for large inputs during inference.", "title": "Max Attention Batch Size", "type": "integer" }, "norm_location": { "default": "post", "enum": [ "pre", "post" ], "title": "Norm Location", "type": "string" }, "layer_norm_eps": { "default": 1e-06, "title": "Layer Norm Eps", "type": "number" }, "num_layers": { "title": "Num Layers", "type": "integer" }, "latent_grid_size": { "anyOf": [ { "maxItems": 3, "minItems": 3, "prefixItems": [ { "type": "integer" }, { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "type": "null" } ], "title": "Latent Grid Size" }, "use_relative_position_embeddings": { "default": true, "title": "Use Relative Position Embeddings", "type": "boolean" } }, "required": [ "dim", "num_heads", "num_layers", "latent_grid_size" ], "title": "Perceiver3DEncoderProcessConfig", "type": "object" } }, "required": [ "encode", "process", "decode" ] }
- Config:
arbitrary_types_allowed: bool = True
extra: str = ignore
validate_default: bool = True
validate_assignment: bool = True
validate_return: bool = True
- Fields:
- Validators:
validate
»all fields
validate_before
»all fields
-
field decode:
Perceiver3DDecoderConfig
[Required]# - Validated by:
- vision_architectures.nets.perceiver_3d.unfold_with_roll_3d(ten, window_size, stride, raise_large_window_error=False, raise_large_stride_error=True)[source]#
- vision_architectures.nets.perceiver_3d.fold_back_3d(windows, positions, output_shape, reduction='mean')[source]#
- class vision_architectures.nets.perceiver_3d.Perceiver3DChannelMapping(config={}, **kwargs)[source]#
Bases:
Module
- __init__(config={}, **kwargs)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class vision_architectures.nets.perceiver_3d.Perceiver3DEncoderEncode(config={}, channel_mapping=None, checkpointing_level=0, **kwargs)[source]#
Bases:
Module
- __init__(config={}, channel_mapping=None, checkpointing_level=0, **kwargs)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(*args, **kwargs)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class vision_architectures.nets.perceiver_3d.Perceiver3DEncoderProcess(config={}, checkpointing_level=0, **kwargs)[source]#
Bases:
Module
- __init__(config={}, checkpointing_level=0, **kwargs)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(*args, **kwargs)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class vision_architectures.nets.perceiver_3d.Perceiver3DEncoder(config={}, channel_mapping=None, checkpointing_level=0, **kwargs)[source]#
Bases:
Module
,PyTorchModelHubMixin
- __init__(config={}, channel_mapping=None, checkpointing_level=0, **kwargs)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(*args, **kwargs)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class vision_architectures.nets.perceiver_3d.Perceiver3DDecoder(config={}, checkpointing_level=0, **kwargs)[source]#
Bases:
Module
,PyTorchModelHubMixin
- __init__(config={}, checkpointing_level=0, **kwargs)[source]#
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(*args, **kwargs)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.