MCPcopy Create free account
hub / github.com/OpenNMT/CTranslate2 / SequenceToSequenceModelConfig

Class SequenceToSequenceModelConfig

python/ctranslate2/specs/model_spec.py:426–461  ·  view source on GitHub ↗

Configuration for sequence-to-sequence models.

Source from the content-addressed store, hash-verified

424
425
426class SequenceToSequenceModelConfig(ModelConfig):
427 """Configuration for sequence-to-sequence models."""
428
429 def __init__(
430 self,
431 unk_token: str = "<unk>",
432 bos_token: str = "<s>",
433 eos_token: str = "</s>",
434 decoder_start_token: Optional[str] = "<s>",
435 add_source_bos: bool = False,
436 add_source_eos: bool = False,
437 **kwargs,
438 ):
439 """Initializes the configuration for sequence-to-sequence models.
440
441 Args:
442 unk_token: The unknown token.
443 bos_token: The start of sentence token.
444 eos_token: The end of sentence token.
445 decoder_start_token: The decoder start token. If ``None``, the token should
446 be passed by the user in the target prefix.
447 add_source_bos: If ``True``, ``bos_token`` will be automatically added to
448 the source input.
449 add_source_eos: If ``True``, ``eos_token`` will be automatically added to
450 the source input.
451 **kwargs: Additional configuration.
452 """
453 super().__init__(
454 unk_token=unk_token,
455 bos_token=bos_token,
456 eos_token=eos_token,
457 decoder_start_token=decoder_start_token,
458 add_source_bos=add_source_bos,
459 add_source_eos=add_source_eos,
460 **kwargs,
461 )
462
463
464class SequenceToSequenceModelSpec(ModelSpec):

Callers 1

get_default_configMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected