(
self,
vocab_size: int,
encoder_output_size: int,
attention_heads: int = 4,
linear_units: int = 2048,
num_blocks: int = 6,
r_num_blocks: int = 0,
dropout_rate: float = 0.1,
positional_dropout_rate: float = 0.1,
self_attention_dropout_rate: float = 0.0,
src_attention_dropout_rate: float = 0.0,
input_layer: str = "embed",
use_output_layer: bool = True,
normalize_before: bool = True,
key_bias: bool = True,
gradient_checkpointing: bool = False,
tie_word_embedding: bool = False,
)
| 274 | """ |
| 275 | |
| 276 | def __init__( |
| 277 | self, |
| 278 | vocab_size: int, |
| 279 | encoder_output_size: int, |
| 280 | attention_heads: int = 4, |
| 281 | linear_units: int = 2048, |
| 282 | num_blocks: int = 6, |
| 283 | r_num_blocks: int = 0, |
| 284 | dropout_rate: float = 0.1, |
| 285 | positional_dropout_rate: float = 0.1, |
| 286 | self_attention_dropout_rate: float = 0.0, |
| 287 | src_attention_dropout_rate: float = 0.0, |
| 288 | input_layer: str = "embed", |
| 289 | use_output_layer: bool = True, |
| 290 | normalize_before: bool = True, |
| 291 | key_bias: bool = True, |
| 292 | gradient_checkpointing: bool = False, |
| 293 | tie_word_embedding: bool = False, |
| 294 | ): |
| 295 | |
| 296 | super().__init__() |
| 297 | self.tie_word_embedding = tie_word_embedding |
| 298 | self.left_decoder = TransformerDecoder( |
| 299 | vocab_size, |
| 300 | encoder_output_size, |
| 301 | attention_heads, |
| 302 | linear_units, |
| 303 | num_blocks, |
| 304 | dropout_rate, |
| 305 | positional_dropout_rate, |
| 306 | self_attention_dropout_rate, |
| 307 | src_attention_dropout_rate, |
| 308 | input_layer, |
| 309 | use_output_layer, |
| 310 | normalize_before, |
| 311 | key_bias=key_bias, |
| 312 | gradient_checkpointing=gradient_checkpointing, |
| 313 | tie_word_embedding=tie_word_embedding) |
| 314 | |
| 315 | self.right_decoder = TransformerDecoder( |
| 316 | vocab_size, |
| 317 | encoder_output_size, |
| 318 | attention_heads, |
| 319 | linear_units, |
| 320 | r_num_blocks, |
| 321 | dropout_rate, |
| 322 | positional_dropout_rate, |
| 323 | self_attention_dropout_rate, |
| 324 | src_attention_dropout_rate, |
| 325 | input_layer, |
| 326 | use_output_layer, |
| 327 | normalize_before, |
| 328 | key_bias=key_bias, |
| 329 | gradient_checkpointing=gradient_checkpointing, |
| 330 | tie_word_embedding=tie_word_embedding) |
| 331 | |
| 332 | def forward( |
| 333 | self, |
nothing calls this directly
no test coverage detected