EmbeddingsSharingLevel

class opennmt.models.EmbeddingsSharingLevel[source]

Level of embeddings sharing.

Possible values are:

  • NONE: no sharing (default)

  • SOURCE_TARGET_INPUT: share source and target word embeddings

  • TARGET: share target word embeddings and softmax weights

  • ALL: share words embeddings and softmax weights

  • AUTO: automatically share embeddings when using the same vocabulary file.

Inherits from: builtins.object

NONE = 0
SOURCE_TARGET_INPUT = 1
TARGET = 2
ALL = 3
AUTO = 4
static share_input_embeddings(level)[source]

Returns True if input embeddings should be shared at level.

static share_target_embeddings(level)[source]

Returns True if target embeddings should be shared at level.