Perceiver io#
- class ivy_models.transformers.perceiver_io.PerceiverIO(spec, v=None, **kwargs)[source]#
Bases:
Module
- __init__(spec, v=None, **kwargs)[source]#
Initialize Ivy layer, which is a stateful object consisting of trainable variables.
- Parameters:
args – Positional arguments to the _build method.
v (
Optional
[Container
], default:None
) – Ivy container of trainable variables. Created internally by default.buffers – Ivy container of buffers/non-trainable arrays in the state_dict.
build_mode – How the Module is built, either on initialization (now), explicitly by the user by calling build(), or the first time the __call__ method is run. Default is on initialization.
store_vars – Whether or not to store the variables created. Default is
True
.with_partial_v – Whether to allow partial specification of variables. Default is
False
.dynamic_backend – When the value is true, allow conversion of arrays from a different backend to the current backend if v passed in the input contains arrays created with different backend.
training – specifies whether the module is in training or evaluation mode. Default is
True
.dtype – Data type to be used for creating model variables. (Default value = None).
device – Device on which to create the module’s variables ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc. (Default value = None).
kwargs – Keyword arguments to the _build method.
- class ivy_models.transformers.perceiver_io.PerceiverIOSpec(input_dim, num_input_axes, output_dim, queries_dim=1024, network_depth=8, num_latents=512, latent_dim=1024, num_cross_att_heads=1, num_self_att_heads=8, cross_head_dim=261, latent_head_dim=128, weight_tie_layers=True, learn_query=True, query_shape=None, attn_dropout=0.0, fc_dropout=0.0, num_lat_att_per_layer=6, cross_attend_in_every_layer=False, with_decoder=True, with_final_head=True, fourier_encode_input=True, num_fourier_freq_bands=6, max_fourier_freq=None, device=None)[source]#
Bases:
Container
- __init__(input_dim, num_input_axes, output_dim, queries_dim=1024, network_depth=8, num_latents=512, latent_dim=1024, num_cross_att_heads=1, num_self_att_heads=8, cross_head_dim=261, latent_head_dim=128, weight_tie_layers=True, learn_query=True, query_shape=None, attn_dropout=0.0, fc_dropout=0.0, num_lat_att_per_layer=6, cross_attend_in_every_layer=False, with_decoder=True, with_final_head=True, fourier_encode_input=True, num_fourier_freq_bands=6, max_fourier_freq=None, device=None)[source]#
Initialize container object from input dict representation.
- Parameters:
dict_in – the dictionary the container should wrap around. Default is
None
.queues – Sequence of multiprocessing queues, each of which returns containers. This enables the current container to be passed around asynchronously while waiting for data. Default is
None
.queue_load_sizes – Size of leading dimension of the containers returned by each queue. Default is
None
.container_combine_method – The method to use for combining containers arriving from different queues. Default is ivy.Container.cont_list_join
queue_timeout – The timeout when waiting for containers to arrive from the queues. Default is global.
print_limit – The total array size limit when printing the container. Default is 10.
key_length_limit – The maximum key length when printing the container. Default is
None
.print_indent – The number of whitespaces to use for indenting when printing the container. Default is 4.
print_line_spacing – The number of extra newlines to use between keys when printing the container. Default is
0
.ivyh – Handle to ivy module to use for the calculations. Default is
None
, which results in the global ivy.default_key_color – The default key color for printing the container to the terminal. Default is ‘green’.
keyword_color_dict – A dict mapping keywords to their termcolor color codes for printing the container. (Default value = None)
rebuild_child_containers – Whether to rebuild container found in dict_in with these constructor params. Default is
False
, in which case the original container are kept as are.build_callable – Whether to treat functions encountered at leaf nodes as further instructions to build the container
types_to_iteratively_nest – The data types to nest iteratively in the dict structure, each type must be iterable. Default is
None
.alphabetical_keys – Whether to sort the container keys alphabetically, or preserve the dict order. Default is
True
.kwargs – keyword arguments for dict creation. Default is
None
.