easydel.modules.opt.modeling_opt_flax#

Flax OPT model.

class easydel.modules.opt.modeling_opt_flax.OPTAttention(*args: Any, **kwargs: Any)[source]#

Bases: FlaxAttentionModule

class easydel.modules.opt.modeling_opt_flax.OPTDecoder(*args: Any, **kwargs: Any)[source]#

Bases: EasyDeLBaseModule

class easydel.modules.opt.modeling_opt_flax.OPTDecoderLayer(*args: Any, **kwargs: Any)[source]#

Bases: Module

class easydel.modules.opt.modeling_opt_flax.OPTForCausalLM(*args: Any, **kwargs: Any)[source]#

Bases: EasyDeLBaseModule

get_decoder()[source]#
get_input_embeddings()[source]#
get_output_embeddings()[source]#
prepare_inputs_for_generation(input_ids, max_length, attention_mask: Optional[Union[Array, ndarray, bool, number]] = None)[source]#

The prepare_inputs_for_generation function is used to prepare the inputs for a generation task.

Parameters
  • self – Access variables that belong to the class

  • input_ids – Pass in the input tokens

  • max_length – Set the length of the sequence to be generated

  • attention_mask – tp.Optional[chex.Array]: Mask the attention weights token_type_ids: tp.Optional[chex.Array]: TokenTypeIds

Returns

A dictionary of the past_key_values, attention_mask and position ids

set_decoder(decoder)[source]#
set_input_embeddings(value)[source]#
set_output_embeddings(new_embeddings)[source]#
update_inputs_for_generation(model_outputs, model_kwargs)[source]#
class easydel.modules.opt.modeling_opt_flax.OPTLearnedPositionalEmbedding(*args: Any, **kwargs: Any)[source]#

Bases: Embed

class easydel.modules.opt.modeling_opt_flax.OPTModel(*args: Any, **kwargs: Any)[source]#

Bases: EasyDeLBaseModule

get_input_embeddings()[source]#
set_input_embeddings(value)[source]#